Skip to content

Commit 2e77b4e

Browse files
authored
add random suffix to test resource names (#12)
Description of changes: * Add random suffix to test resource names * If a test fails and resource does not get cleaned up, this helps prevent `ConflictException` during next test run * Ideally tests should/will cleanup all the resources, but in the worst case, one resource leak should not block PRs By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 10008d6 commit 2e77b4e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

test/e2e/tests/test_policy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from acktest.k8s import condition
2121
from acktest.k8s import resource as k8s
22+
from acktest.resources import random_suffix_name
2223
from e2e import service_marker, CRD_GROUP, CRD_VERSION, load_resource
2324
from e2e.common.types import POLICY_RESOURCE_PLURAL
2425
from e2e.replacement_values import REPLACEMENT_VALUES
@@ -32,7 +33,7 @@
3233
@pytest.mark.canary
3334
class TestPolicy:
3435
def test_crud(self):
35-
policy_name = "my-simple-policy"
36+
policy_name = random_suffix_name("my-simple-policy", 24)
3637
policy_desc = "a simple policy"
3738

3839
replacements = REPLACEMENT_VALUES.copy()

test/e2e/tests/test_role.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
@pytest.mark.canary
3636
class TestRole:
3737
def test_crud(self):
38-
role_name = "my-simple-role"
38+
role_name = random_suffix_name("my-simple-role", 24)
3939
role_desc = "a simple role"
4040
max_sess_duration = 3600 # Note: minimum of 3600 seconds...
4141

0 commit comments

Comments
 (0)