Skip to content

Commit

Permalink
Extract normalizedCompleted from a chi-storage configmap
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-zaitsev committed Dec 17, 2024
1 parent 93b2eb5 commit 5b37e96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tests/e2e/kubectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ def get(kind, name, label="", ns=None, ok_to_fail=False, shell=None):
out = launch(f"get {kind} {name} {label} -o json", ns=ns, ok_to_fail=ok_to_fail, shell=shell)
return json.loads(out.strip())

def get_chi_normalizedCompleted(chi, ns=None, shell=None):
chi_storage = get("configmap", f"chi-storage-{chi}", ns=ns)
return json.loads(chi_storage["data"]["status-normalizedCompleted"])

def create_ns(ns):
if ns is None:
Expand Down
11 changes: 6 additions & 5 deletions tests/e2e/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,9 @@ def test_011_2(self):
)

with Then("Default user plain password should be removed"):
chi = kubectl.get("chi", "test-011-secured-default")
# assert "default/password" in chi["status"]["normalizedCompleted"]["spec"]["configuration"]["users"]
# assert chi["status"]["normalizedCompleted"]["spec"]["configuration"]["users"]["default/password"] == ""
normalizedCompleted = kubectl.get_chi_normalizedCompleted("test-011-secured-default")
assert "default/password" in normalizedCompleted["spec"]["configuration"]["users"]
assert normalizedCompleted["spec"]["configuration"]["users"]["default/password"] == ""

cfm = kubectl.get("configmap", "chi-test-011-secured-default-common-usersd")
assert '<password remove="1"></password>' in cfm["data"]["chop-generated-users.xml"]
Expand Down Expand Up @@ -2621,8 +2621,9 @@ def test_023(self):
assert kubectl.get_field("chi", chi, ".status.usedTemplates[1].name") == "extension-annotations"
# assert kubectl.get_field("chi", chi, ".status.usedTemplates[2].name") == ""

# with Then("Annotation from a template should be populated"):
# assert kubectl.get_field("chi", chi, ".status.normalizedCompleted.metadata.annotations.test") == "test"
with Then("Annotation from a template should be populated"):
normalizedCompleted = kubectl.get_chi_normalizedCompleted(chi)
assert normalizedCompleted["metadata"]["annotations"]["test"] == "test"
with Then("Pod annotation should populated from template"):
assert kubectl.get_field("pod", f"chi-{chi}-single-0-0-0", ".metadata.annotations.test") == "test"
with Then("Environment variable from a template should be populated"):
Expand Down

0 comments on commit 5b37e96

Please sign in to comment.