Skip to content

Commit d2103dc

Browse files
committed
fix: increate test wait time
1 parent 6b22f03 commit d2103dc

File tree

7 files changed

+45
-43
lines changed

7 files changed

+45
-43
lines changed

Diff for: apis/v1alpha1/ack-generate-metadata.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-04-01T02:35:33Z"
3-
build_hash: 980cb1e4734f673d16101cf55206b84ca639ec01
2+
build_date: "2025-04-08T22:25:51Z"
3+
build_hash: 0909e7f0adb8ffe4120a8c20d5d58b991f2539e9
44
go_version: go1.24.1
5-
version: v0.44.0
5+
version: v0.44.0-3-g0909e7f
66
api_directory_checksum: 2f94829f12ad90f9c36c48823459c161c1670093
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: e7e79c3c7c21273967ca24947fda0f26b344c8f0
10+
file_checksum: cc3489b53a45170d339a4de0d7d7ec0aa788955e
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

Diff for: apis/v1alpha1/generator.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ resources:
7474
from:
7575
operation: UpdateContributorInsights
7676
path: ContributorInsightsAction
77+
compare:
78+
is_ignored: true
7779
exceptions:
7880
errors:
7981
404:

Diff for: generator.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ resources:
7474
from:
7575
operation: UpdateContributorInsights
7676
path: ContributorInsightsAction
77+
compare:
78+
is_ignored: true
7779
exceptions:
7880
errors:
7981
404:

Diff for: pkg/resource/table/delta.go

-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pkg/resource/table/hooks.go

+33-30
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,16 @@ func customPreCompare(
615615
// This will ensure controller does not act on this field
616616
// if user is unaware of it.
617617
if a.ko.Spec.ContributorInsights == nil {
618-
a.ko.Spec.ContributorInsights = b.ko.Spec.ContributorInsights
618+
return
619619
}
620+
// latestInsight will always be either ENABLED or DISABLED, since we requeue at readOne if its not
621+
// either
622+
desiredInsight, _ := prepareContibutorInsight(a)
623+
latestInsight, _ := prepareContibutorInsight(b)
624+
if desiredInsight != latestInsight {
625+
delta.Add("Spec.ContributorInsights", a.ko.Spec.ContributorInsights, b.ko.Spec.ContributorInsights)
626+
}
627+
620628
}
621629

622630
// equalAttributeDefinitions return whether two AttributeDefinition arrays are equal or not.
@@ -774,41 +782,18 @@ func (rm *resourceManager) setContributorInsights(
774782
if err != nil {
775783
return err
776784
}
777-
778-
// This portion is needed if we want to have a smooth delta comparison
779-
// If the name ends in ED (ENABLED, DISABLED) just assign the value
780-
endsWithED := false
785+
786+
// Only manage ContributorInsights if it is defined
781787
if ko.Spec.ContributorInsights != nil {
782-
endsWithED = strings.HasSuffix(*ko.Spec.TableName, "ED")
783-
}
784-
if endsWithED {
785788
ko.Spec.ContributorInsights = aws.String(string(resp.ContributorInsightsStatus))
786-
return nil
787-
}
788-
// if not do the conversion
789-
switch resp.ContributorInsightsStatus {
790-
case svcsdktypes.ContributorInsightsStatusEnabled:
791-
ko.Spec.ContributorInsights = aws.String(string(svcsdktypes.ContributorInsightsActionEnable))
792-
case svcsdktypes.ContributorInsightsStatusDisabled:
793-
ko.Spec.ContributorInsights = aws.String(string(svcsdktypes.ContributorInsightsActionDisable))
794-
default:
795-
ko.Spec.ContributorInsights = aws.String(string(resp.ContributorInsightsStatus))
796-
797789
}
798790

799791
return nil
800792
}
801793

802-
func (rm *resourceManager) updateContributorInsights(
803-
ctx context.Context,
804-
r *resource,
805-
) (err error) {
806-
rlog := ackrtlog.FromContext(ctx)
807-
exit := rlog.Trace("rm.updateCloudformationInsights")
808-
defer func() {
809-
exit(err)
810-
}()
811-
794+
// prepareContributorInsight ensures the controller understands ENABLE and ENABLED are the same.
795+
// We choose to return ContributorInsightsAction because that is the enum used to update.
796+
func prepareContibutorInsight(r *resource) (svcsdktypes.ContributorInsightsAction, error) {
812797
insight := svcsdktypes.ContributorInsightsActionDisable
813798
if r.ko.Spec.ContributorInsights != nil {
814799
// We will allow users to provide values ENABLE, ENABLED, DISABLE, DISABLED
@@ -818,10 +803,28 @@ func (rm *resourceManager) updateContributorInsights(
818803
case string(svcsdktypes.ContributorInsightsActionDisable), string(svcsdktypes.ContributorInsightsStatusDisabled):
819804
insight = svcsdktypes.ContributorInsightsActionDisable
820805
default:
821-
return fmt.Errorf("invalid ContributorInsights value: %s", *r.ko.Spec.ContributorInsights)
806+
return "", fmt.Errorf("invalid ContributorInsights value: %s", *r.ko.Spec.ContributorInsights)
822807
}
823808
}
824809

810+
return insight, nil
811+
}
812+
813+
func (rm *resourceManager) updateContributorInsights(
814+
ctx context.Context,
815+
r *resource,
816+
) (err error) {
817+
rlog := ackrtlog.FromContext(ctx)
818+
exit := rlog.Trace("rm.updateCloudformationInsights")
819+
defer func() {
820+
exit(err)
821+
}()
822+
823+
insight, err := prepareContibutorInsight(r)
824+
if err != nil {
825+
return fmt.Errorf("failed preparing contributorInsight: %v", err)
826+
}
827+
825828
_, err = rm.sdkapi.UpdateContributorInsights(
826829
ctx,
827830
&svcsdk.UpdateContributorInsightsInput{

Diff for: test/e2e/resources/table_insights.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spec:
77
tableName: $TABLE_NAME
88
billingMode: PAY_PER_REQUEST
99
tableClass: STANDARD
10-
contributorInsights: ENABLE
10+
contributorInsights: ENABLED
1111
attributeDefinitions:
1212
- attributeName: Bill
1313
attributeType: S

Diff for: test/e2e/tests/test_table.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ def test_enable_ttl(self, table_lsi):
279279
# Patch k8s resource
280280
k8s.patch_custom_resource(ref, updates)
281281

282+
time.sleep(MODIFY_WAIT_AFTER_SECONDS)
283+
282284
table.wait_until(
283285
table_name,
284286
table.ttl_on_attribute_matches("ForumName"),
@@ -480,7 +482,7 @@ def test_update_insights(self, table_insights):
480482

481483
# Check DynamoDB Table exists
482484
assert self.table_exists(table_name)
483-
assert cr['spec']['contributorInsights'] == "ENABLE"
485+
assert cr['spec']['contributorInsights'] == "ENABLED"
484486
assert self.table_insight_status(table_name, "ENABLED")
485487

486488
# Set provisionedThroughput

0 commit comments

Comments
 (0)