Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/aws-controllers-k8s/runtime => github.com/gustavodiaz7722/ack-runtime v0.54.0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
github.com/aws-controllers-k8s/kms-controller v1.0.21 h1:ar8gCdl/l7qbXzr48YN5tNq4vJbB5UqnRH7pAIkP3tI=
github.com/aws-controllers-k8s/kms-controller v1.0.21/go.mod h1:tHFXV8lkrzautPPvQtPUJABPlJ9MXPRj8GB1UublGHQ=
github.com/aws-controllers-k8s/runtime v0.52.0 h1:Q5UIAn6SSBr60t/DiU/zr6NLBlUuK2AG3yy2ma/9gDU=
github.com/aws-controllers-k8s/runtime v0.52.0/go.mod h1:OkUJN+Ds799JLYZsMJrO2vDJ4snxUeHK2MgrQHbU+Qc=
github.com/aws/aws-sdk-go v1.49.0 h1:g9BkW1fo9GqKfwg2+zCD+TW/D36Ux+vtfJ8guF4AYmY=
github.com/aws/aws-sdk-go v1.49.0/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go-v2 v1.36.0 h1:b1wM5CcE65Ujwn565qcwgtOTT1aT4ADOHHgglKjG7fk=
Expand Down Expand Up @@ -88,6 +86,8 @@ github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgY
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gustavodiaz7722/ack-runtime v0.54.0 h1:Mxf2oUm5Skgf0sLik5otKE5+I2+0ziC1aRWZJOwRiWQ=
github.com/gustavodiaz7722/ack-runtime v0.54.0/go.mod h1:OkUJN+Ds799JLYZsMJrO2vDJ4snxUeHK2MgrQHbU+Qc=
github.com/itchyny/gojq v0.12.6 h1:VjaFn59Em2wTxDNGcrRkDK9ZHMNa8IksOgL13sLL4d0=
github.com/itchyny/gojq v0.12.6/go.mod h1:ZHrkfu7A+RbZLy5J1/JKpS4poEqrzItSTGDItqsfP0A=
github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU=
Expand Down
30 changes: 15 additions & 15 deletions test/e2e/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from acktest.k8s import resource

CONDITION_TYPE_ADOPTED = "ACK.Adopted"
CONDITION_TYPE_RESOURCE_SYNCED = "ACK.ResourceSynced"
CONDITION_TYPE_READY = "Ready"
CONDITION_TYPE_TERMINAL = "ACK.Terminal"
CONDITION_TYPE_RECOVERABLE = "ACK.Recoverable"
CONDITION_TYPE_ADVISORY = "ACK.Advisory"
Expand All @@ -28,11 +28,11 @@

def assert_type_status(
ref: resource.CustomResourceReference,
cond_type_match: str = CONDITION_TYPE_RESOURCE_SYNCED,
cond_type_match: str = CONDITION_TYPE_READY,
cond_status_match: bool = True,
):
"""Asserts that the supplied resource has a condition of type
ACK.ResourceSynced and that the Status of this condition is True.
Ready and that the Status of this condition is True.

Usage:
from acktest.k8s import resource
Expand All @@ -46,7 +46,7 @@ def assert_type_status(
resource.wait_resource_consumed_by_controller(ref)
condition.assert_type_status(
ref,
condition.CONDITION_TYPE_RESOURCE_SYNCED,
condition.CONDITION_TYPE_READY,
False)

Raises:
Expand All @@ -71,7 +71,7 @@ def assert_synced_status(
cond_status_match: bool,
):
"""Asserts that the supplied resource has a condition of type
ACK.ResourceSynced and that the Status of this condition is True.
Ready and that the Status of this condition is True.

Usage:
from acktest.k8s import resource
Expand All @@ -86,15 +86,15 @@ def assert_synced_status(
condition.assert_synced_status(ref, False)

Raises:
pytest.fail when ACK.ResourceSynced condition is not found or is not in
pytest.fail when Ready condition is not found or is not in
a True status.
"""
assert_type_status(ref, CONDITION_TYPE_RESOURCE_SYNCED, cond_status_match)
assert_type_status(ref, CONDITION_TYPE_READY, cond_status_match)


def assert_synced(ref: resource.CustomResourceReference):
def assert_ready(ref: resource.CustomResourceReference):
"""Asserts that the supplied resource has a condition of type
ACK.ResourceSynced and that the Status of this condition is True.
Ready and that the Status of this condition is True.

Usage:
from acktest.k8s import resource
Expand All @@ -106,18 +106,18 @@ def assert_synced(ref: resource.CustomResourceReference):
)
resource.create_custom_resource(ref, resource_data)
resource.wait_resource_consumed_by_controller(ref)
condition.assert_synced(ref)
condition.assert_ready(ref)

Raises:
pytest.fail when ACK.ResourceSynced condition is not found or is not in
pytest.fail when Ready condition is not found or is not in
a True status.
"""
return assert_synced_status(ref, True)


def assert_not_synced(ref: resource.CustomResourceReference):
def assert_not_ready(ref: resource.CustomResourceReference):
"""Asserts that the supplied resource has a condition of type
ACK.ResourceSynced and that the Status of this condition is False.
Ready and that the Status of this condition is False.

Usage:
from acktest.k8s import resource
Expand All @@ -129,10 +129,10 @@ def assert_not_synced(ref: resource.CustomResourceReference):
)
resource.create_custom_resource(ref, resource_data)
resource.wait_resource_consumed_by_controller(ref)
condition.assert_not_synced(ref)
condition.assert_not_ready(ref)

Raises:
pytest.fail when ACK.ResourceSynced condition is not found or is not in
pytest.fail when Ready condition is not found or is not in
a False status.
"""
return assert_synced_status(ref, False)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@38ce32256cc2552ab54e190cc8a8618e93af9e0c
acktest @ git+https://github.com/gustavodiaz7722/ack-test-infra.git@77f6bc5602557fe48e0dd157fefbd97a6aa3e54b
2 changes: 1 addition & 1 deletion test/e2e/tests/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_smoke(self, dynamodb_client, dynamodb_table):
20,
5,
)
condition.assert_synced(ref)
condition.assert_ready(ref)

backupArn = k8s.get_resource_arn(cr)
# Check DynamoDB Backup exists
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/test_global_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_smoke(self, dynamodb_client, dynamodb_table):
10,
5,
)
condition.assert_synced(ref)
condition.assert_ready(ref)

# Check DynamoDB Global Table exists
exists = self.global_table_exists(dynamodb_client, global_table_name)
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def test_create_delete(self, table_lsi):
(ref, res) = table_lsi

table_name = res["spec"]["tableName"]
condition.assert_synced(ref)
condition.assert_ready(ref)

# Check DynamoDB Table exists
assert self.table_exists(table_name)
Expand Down Expand Up @@ -476,7 +476,7 @@ def test_update_insights(self, table_insights):
(ref, res) = table_insights

table_name = res["spec"]["tableName"]
assert k8s.wait_on_condition(ref, "ACK.ResourceSynced", "True", wait_periods=5)
assert k8s.wait_on_condition(ref, "Ready", "True", wait_periods=5)

cr = k8s.get_resource(ref)

Expand All @@ -493,7 +493,7 @@ def test_update_insights(self, table_insights):
}
# Patch k8s resource
k8s.patch_custom_resource(ref, updates)
assert k8s.wait_on_condition(ref, "ACK.ResourceSynced", "True", wait_periods=5)
assert k8s.wait_on_condition(ref, "Ready", "True", wait_periods=5)
cr = k8s.get_resource(ref)
assert cr['spec']['contributorInsights'] == "DISABLE"
assert self.table_insight_status(table_name, "DISABLED")
Expand Down
15 changes: 3 additions & 12 deletions test/e2e/tests/test_table_replicas.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,25 +372,16 @@ def test_terminal_condition_for_invalid_stream_specification(self, table_with_in
max_wait_seconds = 120
interval_seconds = 10
start_time = time.time()
terminal_condition_found = False

while time.time() - start_time < max_wait_seconds:
try:
condition.assert_type_status(
ref,
condition.CONDITION_TYPE_TERMINAL,
True)

terminal_condition_found = True
cond = k8s.get_resource_condition(
ref, condition.CONDITION_TYPE_TERMINAL)
assert "table must have DynamoDB Streams enabled with StreamViewType set to NEW_AND_OLD_IMAGES" in cond[
"message"]
condition.assert_terminal(ref, "table must have DynamoDB Streams enabled with StreamViewType set to NEW_AND_OLD_IMAGES")
break
except:
time.sleep(interval_seconds)

assert terminal_condition_found, "Terminal condition was not set for invalid StreamSpecification"
condition.assert_terminal(ref, "table must have DynamoDB Streams enabled with StreamViewType set to NEW_AND_OLD_IMAGES")


def test_staged_replicas_and_gsi_updates(self, table_replicas_gsi):
(ref, cr) = table_replicas_gsi
Expand Down