Skip to content

Commit

Permalink
resolved sonobuoy filename issue
Browse files Browse the repository at this point in the history
Signed-off-by: Katharina Trentau <[email protected]>
  • Loading branch information
Katharina Trentau committed Oct 2, 2024
1 parent 92093b0 commit 91678b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Tests/kaas/k8s-default-storage-class/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setup_k8s_client(kubeconfigfile=None):


def gen_sonobuoy_result_file(error_n: int, error_msg: str, test_file_name: str):
test_name = test_file_name.replace(".py", "")
test_name = test_file_name.removesuffix(".py")
test_status = "passed"
if error_n != 0:
test_status = test_name + "_" + str(error_n)
Expand All @@ -65,8 +65,8 @@ def gen_sonobuoy_result_file(error_n: int, error_msg: str, test_file_name: str):
result_file["status"] = test_status
result_file["details"]["messages"] = error_msg

directory_path = os.path.dirname(f"./{test_name}.result.yaml")
os.makedirs(directory_path, exist_ok=True)
# directory_path = os.path.dirname(f"./{test_name}.result.yaml")
# os.makedirs(directory_path, exist_ok=True)

with open(f"./{test_name}.result.yaml", "w") as file:
yaml.dump(result_file, file)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import time
import json
import logging
import os

from kubernetes import client
from helper import gen_sonobuoy_result_file
Expand Down Expand Up @@ -263,7 +264,7 @@ def main(argv):
if return_code == 0:
return_message = "all tests passed"

gen_sonobuoy_result_file(return_code, return_message, __file__)
gen_sonobuoy_result_file(return_code, return_message, os.path.basename(__file__))

return return_code

Expand Down

0 comments on commit 91678b1

Please sign in to comment.