Skip to content

Commit

Permalink
Added test for 'avoidNamespaces' field changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tymuraheiev committed Jan 21, 2025
1 parent b997f0c commit e4489b4
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions conformance/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,48 @@ def test_patch_cluster_secret_match_namespaces(self):
f'secret {name} should be in all user namespaces'
)

def test_patch_cluster_secret_avoid_namespaces(self):
name = "dynamic-cluster-secret-avoid-namespaces"
username_data = "MTIzNDU2Cg=="

# Create a secret in all user namespaces
self.cluster_secret_manager.create_cluster_secret(
name=name,
data={"username": username_data},
match_namespace=USER_NAMESPACES
)

# We expect the secret to be in all user namespaces
self.assertTrue(
self.cluster_secret_manager.validate_namespace_secrets(
name=name,
data={"username": username_data},
namespaces=USER_NAMESPACES,
)
)

# Update the cluster avoid_namespaces to exclude second namespace
self.cluster_secret_manager.update_data_cluster_secret(
name=name,
data={"username": username_data},
match_namespace=USER_NAMESPACES,
avoid_namespaces=[
USER_NAMESPACES[1]
],
)

self.assertTrue(
self.cluster_secret_manager.validate_namespace_secrets(
name=name,
data={"username": username_data},
namespaces=[
USER_NAMESPACES[1]
],
check_missing=True,
),
f'secret {name} should be deleted from second namespace'
)

def test_simple_cluster_secret_deleted(self):
name = "simple-cluster-secret-deleted"
username_data = "MTIzNDU2Cg=="
Expand Down

0 comments on commit e4489b4

Please sign in to comment.