Skip to content

Commit

Permalink
chore: Update verify_scenario method to accept current_datetime param…
Browse files Browse the repository at this point in the history
…eter
  • Loading branch information
kooomix committed Jul 28, 2024
1 parent 06fee6e commit accabf8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions systest_utils/scenarios_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion tests_scripts/helm/ks_microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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")
Expand Down

0 comments on commit accabf8

Please sign in to comment.