Skip to content

Commit fd9203d

Browse files
NAT Gateway test fix (#111)
Description of changes: - Added `Resource.Synced` checks after creating the resource in order to check whether resource is synced or not. - Added wait times after deleting the resource. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent b161bb6 commit fd9203d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/e2e/tests/test_nat_gateway.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ def standard_elastic_address():
5858
# buy us some time in case we try to mount it too early.
5959
time.sleep(CREATE_WAIT_AFTER_SECONDS)
6060

61+
# Check resource synced successfully
62+
assert k8s.wait_on_condition(ref, "ACK.ResourceSynced", "True", wait_periods=10)
63+
6164
assert cr is not None
6265
assert k8s.get_resource_exists(ref)
6366

@@ -66,6 +69,7 @@ def standard_elastic_address():
6669
# Try to delete, if doesn't already exist
6770
try:
6871
_, deleted = k8s.delete_custom_resource(ref, 3, 10)
72+
time.sleep(DELETE_WAIT_AFTER_SECONDS)
6973
assert deleted
7074
except:
7175
pass
@@ -106,10 +110,13 @@ def simple_nat_gateway(standard_elastic_address, request):
106110
k8s.create_custom_resource(ref, resource_data)
107111
cr = k8s.wait_resource_consumed_by_controller(ref)
108112

109-
# ElasticIP are not usable immediately after they are created, so this will
113+
# NAT Gateways are not usable immediately after they are created, so this will
110114
# buy us some time in case we try to mount it too early.
111115
time.sleep(CREATE_WAIT_AFTER_SECONDS)
112116

117+
# Check resource synced successfully
118+
assert k8s.wait_on_condition(ref, "ACK.ResourceSynced", "True", wait_periods=5)
119+
113120
assert cr is not None
114121
assert k8s.get_resource_exists(ref)
115122

@@ -118,6 +125,7 @@ def simple_nat_gateway(standard_elastic_address, request):
118125
# Try to delete, if doesn't already exist
119126
try:
120127
_, deleted = k8s.delete_custom_resource(ref, 3, 10)
128+
time.sleep(DELETE_WAIT_AFTER_SECONDS)
121129
assert deleted
122130
except:
123131
pass

0 commit comments

Comments
 (0)