From 9594ad7e9843b4c0de37677be702057e50283a8e Mon Sep 17 00:00:00 2001 From: Bartlomiej Gmerek Date: Wed, 11 Dec 2024 13:36:38 +0100 Subject: [PATCH] Updates tests to use fiveg_core_gnb interface --- terraform/integration_tests.auto.tfvars.j2 | 1 + terraform/main.tf | 16 ++++--------- terraform/variables.tf | 8 ++++++- tests/integration/test_integration.py | 27 +++++++++------------- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/terraform/integration_tests.auto.tfvars.j2 b/terraform/integration_tests.auto.tfvars.j2 index d1d1d26..88b3fe5 100644 --- a/terraform/integration_tests.auto.tfvars.j2 +++ b/terraform/integration_tests.auto.tfvars.j2 @@ -1 +1,2 @@ sdcore_model_name = "{{ sdcore_model_name }}" +ran_model_name = "{{ ran_model_name }}" diff --git a/terraform/main.tf b/terraform/main.tf index db073cd..a2cf344 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -21,7 +21,7 @@ module "sdcore" { } resource "juju_model" "ran-simulator" { - name = "ran" + name = var.ran_model_name } module "gnbsim" { @@ -31,12 +31,6 @@ module "gnbsim" { depends_on = [module.sdcore-router] } -resource "juju_offer" "gnbsim-fiveg-gnb-identity" { - model = juju_model.ran-simulator.name - application_name = module.gnbsim.app_name - endpoint = module.gnbsim.provides.fiveg_gnb_identity -} - resource "juju_integration" "gnbsim-amf" { model = juju_model.ran-simulator.name @@ -51,15 +45,15 @@ resource "juju_integration" "gnbsim-amf" { } resource "juju_integration" "gnbsim-nms" { - model = juju_model.sdcore.name + model = juju_model.ran-simulator.name application { - name = module.sdcore.nms_app_name - endpoint = module.sdcore.fiveg_gnb_identity_endpoint + name = module.gnbsim.app_name + endpoint = module.gnbsim.requires.fiveg_core_gnb } application { - offer_url = juju_offer.gnbsim-fiveg-gnb-identity.url + offer_url = module.sdcore.nms_fiveg_core_gnb_offer_url } } diff --git a/terraform/variables.tf b/terraform/variables.tf index 2efa6df..38e007a 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -2,7 +2,13 @@ # See LICENSE file for licensing details. variable "sdcore_model_name" { - description = "Name of Juju model to deploy application to." + description = "Name of Juju model to deploy Charmed Aether SD-Core to." type = string default = "sdcore" } + +variable "ran_model_name" { + description = "Name of Juju model to deploy RAN simulator to." + type = string + default = "ran" +} diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 424c02c..c72a68a 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -41,8 +41,8 @@ def setup_class(cls): @pytest.mark.abort_on_fail async def test_given_sdcore_terraform_module_when_deploy_then_status_is_active(self): self._deploy_sdcore() - juju_helper.juju_wait_for_active_idle(model_name=SDCORE_MODEL_NAME, timeout=1200) - juju_helper.juju_wait_for_active_idle(model_name=RAN_MODEL_NAME, timeout=1200) + juju_helper.juju_wait_for_active_idle(model_name=SDCORE_MODEL_NAME, timeout=900) + juju_helper.juju_wait_for_active_idle(model_name=RAN_MODEL_NAME, timeout=300) @pytest.mark.abort_on_fail async def test_given_sdcore_bundle_and_gnbsim_deployed_when_start_simulation_then_simulation_success_status_is_true( # noqa: E501 @@ -55,20 +55,14 @@ async def test_given_sdcore_bundle_and_gnbsim_deployed_when_start_simulation_the if not username or not password: raise Exception("NMS credentials not found.") configure_sdcore(username, password) - for _ in range(5): - action_output = juju_helper.juju_run_action( - model_name=RAN_MODEL_NAME, - application_name="gnbsim", - unit_number=0, - action_name="start-simulation", - timeout=6 * 60, - ) - try: - assert action_output["success"] == "true" - return - except AssertionError: - continue - assert False + action_output = juju_helper.juju_run_action( + model_name=RAN_MODEL_NAME, + application_name="gnbsim", + unit_number=0, + action_name="start-simulation", + timeout=6 * 60, + ) + assert action_output["success"] == "true" @pytest.mark.skip( reason="Traefik issue: https://github.com/canonical/traefik-k8s-operator/issues/361" @@ -117,6 +111,7 @@ def _generate_tfvars_file(): template = jinja2_environment.get_template(f"{TFVARS_FILE}.j2") content = template.render( sdcore_model_name=SDCORE_MODEL_NAME, + ran_model_name=RAN_MODEL_NAME, ) with open(f"{TERRAFORM_DIR}/{TFVARS_FILE}", mode="w") as tfvars: tfvars.write(content)