Skip to content

Commit

Permalink
Updates tests to use fiveg_core_gnb interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Gmerold committed Dec 11, 2024
1 parent 99d2375 commit 9594ad7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
1 change: 1 addition & 0 deletions terraform/integration_tests.auto.tfvars.j2
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sdcore_model_name = "{{ sdcore_model_name }}"
ran_model_name = "{{ ran_model_name }}"
16 changes: 5 additions & 11 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module "sdcore" {
}

resource "juju_model" "ran-simulator" {
name = "ran"
name = var.ran_model_name
}

module "gnbsim" {
Expand All @@ -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

Expand All @@ -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
}
}

Expand Down
8 changes: 7 additions & 1 deletion terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
27 changes: 11 additions & 16 deletions tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9594ad7

Please sign in to comment.