diff --git a/src/validation_workflow/rpm/validation_rpm.py b/src/validation_workflow/rpm/validation_rpm.py index b29ede4690..173e144cd7 100644 --- a/src/validation_workflow/rpm/validation_rpm.py +++ b/src/validation_workflow/rpm/validation_rpm.py @@ -39,7 +39,12 @@ def start_cluster(self) -> bool: try: for project in self.args.projects: execute(f'sudo systemctl start {project}', ".") - (status, _, _) = execute(f'sudo systemctl status {project}', ".") + (stdout, stderr, status) = execute(f'sudo systemctl status {project}', ".") + if(status == 0): + logging.info(stdout) + else: + logging.info(stderr) + except: raise Exception('Failed to Start Cluster') return True @@ -122,8 +127,7 @@ def validate_signature(self) -> None: present_key.append(key) logging.info("Validation of all key digests starts: ") for digest in key_list: - if digest in present_key: - logging.info(f'Key digest "{digest}" is validated to be present.') - else: - raise ValueError(f'Key digest "{digest}" is not found') + assert digest in present_key + logging.info(f'Key digest "{digest}" is validated to be present.') + logging.info("Validation for signature of RPM distribution completed.") diff --git a/tests/tests_validation_workflow/test_validation_rpm.py b/tests/tests_validation_workflow/test_validation_rpm.py index 2d38f91f01..0412f778c9 100644 --- a/tests/tests_validation_workflow/test_validation_rpm.py +++ b/tests/tests_validation_workflow/test_validation_rpm.py @@ -326,12 +326,12 @@ def test_validate_signature_except(self, mock_temporary_directory: Mock, mock_va mock_temporary_directory.return_value.path = "/tmp/trytytyuit/" validate_rpm.filename = 'example.rpm' - with self.assertRaises(Exception) as context: + with self.assertRaises(AssertionError) as context: validate_rpm.validate_signature() mock_logging_info.assert_any_call('Key digest "Header SHA256 digest" is validated to be present.') mock_logging_info.assert_any_call('Key digest "Payload SHA256 digest" is validated to be present.') mock_logging_info.assert_any_call('Validation of all key digests starts: ') - self.assertEqual(str(context.exception), 'Key digest "MD5 digest" is not found') + self.assertIsInstance(context.exception, AssertionError) mock_execute.assert_called_once_with( 'rpm -K -v /tmp/trytytyuit/example.rpm', '.'