- if topic_created:
- logger.info("Topic created successfully")
- else:
- logger.info("Topic creation failed")
-
-def policy_component_ready():
- """Check if components are ready."""
- logger.info("Verify policy components are ready")
- policy_ready = {"api_ready": False, "pap_ready": False, "apex_ready": False}
- for x in range(60):
- logger.info("Iteration %s", x)
- policy_status = policy.get_components_status(settings.POLICY_BASICAUTH)
- if (policy_status["api"]["healthy"] and not policy_ready["api_ready"]):
- logger.info("Policy Api is ready")
- policy_ready["api_ready"] = True
- if (policy_status["pap"]["healthy"] and not policy_ready["pap_ready"]):
- logger.info("Policy Pap is ready")
- policy_ready["pap_ready"] = True
- if (policy_status["pdps"]["apex"][0]["healthy"] == "HEALTHY" and not policy_ready["apex_ready"]):
- logger.info("Policy Apex is ready")
- policy_ready["apex_ready"] = True
- if (policy_ready["api_ready"] and policy_ready["pap_ready"] and policy_ready["apex_ready"]):
- logger.info("Policy status all ready")
- break
+@pytest.fixture(scope="module", autouse=True)
+def setup_simulators():
+ """Setup the simulators before the executing the tests."""
+ logger.info("Test class setup for Apex tests")
+
+ dmaap.create_topic(TOPIC_FAULT)
+ # Purge the FAULT TOPIC
+ wait(lambda: (dmaap.get_message_from_topic("unauthenticated.SEC_FAULT_OUTPUT", 5000, settings.DMAAP_GROUP, settings.DMAAP_USER).json() == []), sleep_seconds=10, timeout_seconds=60, waiting_for="DMaap topic unauthenticated.SEC_FAULT_OUTPUT to be empty")
+
+ network_simulators.start_network_simulators()
+ network_simulators.wait_for_network_simulators_to_be_running()