From 98c542e7cc4cd2651d5c8a58296a80d636c7024d Mon Sep 17 00:00:00 2001 From: Roman Plevka Date: Tue, 23 Apr 2024 15:29:37 +0200 Subject: [PATCH] add e2e provider_labels fn test for AA --- pyproject.toml | 1 + tests/functional/test_satlab.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f2103ec4..c2c59d7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ beaker = ["beaker-client"] dev = [ "pre-commit", "pytest", + "pytest-mock", "ruff" ] docker = [ diff --git a/tests/functional/test_satlab.py b/tests/functional/test_satlab.py index a2997915..e108a274 100644 --- a/tests/functional/test_satlab.py +++ b/tests/functional/test_satlab.py @@ -124,3 +124,17 @@ def test_tower_host_mp(): ) res = r_hosts[1].execute(f"ls /root") assert SETTINGS_PATH.name in res.stdout + + +def test_tower_provider_labels(): + """Assert labels being created on AAP and OSP metadata + being attached accordingly + """ + with Broker(workflow="deploy-rhel", provider_labels={"l1": "v1", "l2": ""}) as r_host: + # check provider labels in the resulting host object + assert r_host.provider_labels.get("l1") == "v1" + assert r_host.provider_labels.get("l2") == "" + # assert the AAP labels got created on the provider + aap_labels = [l.name for l in r_host._prov_inst.v2.labels.get().results] + assert "l1=v1" in aap_labels + assert "l2" in aap_labels