From 83185c5d02c7fdeec931fbee0f7a5d0f582d5c43 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 dc755a23..8f5fca36 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 bac090f3..da58f60f 100644 --- a/tests/functional/test_satlab.py +++ b/tests/functional/test_satlab.py @@ -122,3 +122,17 @@ def test_tower_host_mp(): ) res = r_hosts[1].execute(f"ls /root") assert loc_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