From accabf8b3ce8c62d67f5d0bc6541ec8b30ebd0dd Mon Sep 17 00:00:00 2001 From: kooomix Date: Sun, 28 Jul 2024 10:13:51 +0300 Subject: [PATCH] chore: Update verify_scenario method to accept current_datetime parameter --- systest_utils/scenarios_manager.py | 5 +++-- tests_scripts/helm/ks_microservice.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/systest_utils/scenarios_manager.py b/systest_utils/scenarios_manager.py index 2661d510..681975c9 100644 --- a/systest_utils/scenarios_manager.py +++ b/systest_utils/scenarios_manager.py @@ -111,11 +111,12 @@ class AttackChainsScenarioManager(ScenarioManager): def __init__(self, test_obj, backend: backend_api.ControlPanelAPI, cluster, namespace): super().__init__(test_obj, backend, cluster, namespace, SCENARIOS_TEST_PATH) - def verify_scenario(self): + def verify_scenario(self, current_datetime=None): """ verify_scenario validate the attack chains results on the backend """ - current_datetime = datetime.now(timezone.utc) + if current_datetime == None: + current_datetime = datetime.now(timezone.utc) Logger.logger.info("wait for response from BE") r, t = self.wait_for_report( self.backend.get_active_attack_chains, diff --git a/tests_scripts/helm/ks_microservice.py b/tests_scripts/helm/ks_microservice.py index f201ab94..d535f1e8 100644 --- a/tests_scripts/helm/ks_microservice.py +++ b/tests_scripts/helm/ks_microservice.py @@ -344,6 +344,8 @@ def start(self): self.ignore_agent = True cluster, namespace = self.setup(apply_services=False) + current_datetime = datetime.now(timezone.utc) + Logger.logger.info('1. Install attack-chains scenario manifests in the cluster') Logger.logger.info( f"1.1 construct AttackChainsScenarioManager with test_scenario: {self.test_obj[('test_scenario', None)]} and cluster {cluster}") @@ -365,7 +367,7 @@ def start(self): time.sleep(10) Logger.logger.info("3. Verify scenario on backend") - scenarios_manager.verify_scenario() + scenarios_manager.verify_scenario(current_datetime) Logger.logger.info("attack chains detected, applying fix command") Logger.logger.info("4. Apply attack chain fix")