diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2020-12-07 09:31:03 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-12-07 09:31:03 +0000 |
commit | f4f2c3da532bb8318ebd83a8e1bef8e97f8da2e9 (patch) | |
tree | 7342cb54a466282c2f199b665a3c401a1ccfdb1e | |
parent | 91c5d0b3e95aaf3b112c4f06d9001b90a1b402c8 (diff) | |
parent | 30f2fbe6b093183cf885626b03f10717cb0da391 (diff) |
Merge "[SECURITY] S3 Support"
-rw-r--r-- | security/onap_security/security_tests.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/security/onap_security/security_tests.py b/security/onap_security/security_tests.py index 4c7af29..cdfafcd 100644 --- a/security/onap_security/security_tests.py +++ b/security/onap_security/security_tests.py @@ -50,32 +50,29 @@ class SecurityTesting(testcase.TestCase): raise Exception(output) # create a log file - file_name = "/var/lib/xtesting/results/" + self.case_name + ".log" - log_file = open(file_name, "w") - log_file.write(output) - log_file.close() + file_name = "{0}/{1}.log".format(self.res_dir, self.case_name) + try: + with open(file_name, 'w') as log_file: + log_file.write(output) + except Exception as exc: + print(exc) + # we consider the command return code for success criteria if process.returncode is None: - success = False - details = self.error_string + self.result = 0 if (self.case_name == 'kube_hunter' and "No vulnerabilities were found" in output): - success = True + self.result = 100 + else: + self.details = {'error': self.error_string} elif process.returncode != 0: - success = False - details = self.error_string + self.result = 0 + self.details = {'error': self.error_string} else: - success = True - details = "Test PASS" - - self.details = details - self.__logger.info("details: %s", details) - - if success: self.result = 100 - else: - self.result = 0 + + self.__logger.info("details: %s", self.details) def run(self, **kwargs): """Generic Run.""" |