Skip to content

Commit 9dc270f

Browse files
committed
add tests
1 parent 3cc1a09 commit 9dc270f

File tree

13 files changed

+501
-25
lines changed

13 files changed

+501
-25
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-03-12T23:25:20Z"
2+
build_date: "2025-03-14T22:21:35Z"
33
build_hash: 5645e51ed3c413f616e1b929f1527a5139c44198
44
go_version: go1.24.0
55
version: v0.43.2-3-g5645e51
66
api_directory_checksum: 0d5b95bdbe63c6cfc495149b7a86440c4a5fb33a
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: 48323d41b9cb7ade08c8a87367846cccdd1f6409
10+
file_checksum: 85db04e11e016a28a99058aab04767cf8345242e
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ resources:
8080
code: ResourceNotFoundException
8181
terminal_codes:
8282
- InvalidParameter
83+
- ValidationException
8384
update_operation:
8485
custom_method_name: customUpdateTable
8586
hooks:

generator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ resources:
8080
code: ResourceNotFoundException
8181
terminal_codes:
8282
- InvalidParameter
83+
- ValidationException
8384
update_operation:
8485
custom_method_name: customUpdateTable
8586
hooks:

pkg/resource/table/hooks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var (
7878
)
7979
requeueWaitWhileUpdating = ackrequeue.NeededAfter(
8080
ErrTableUpdating,
81-
5*time.Second,
81+
10*time.Second,
8282
)
8383
requeueWaitGSIReady = ackrequeue.NeededAfter(
8484
ErrTableGSIsUpdating,

pkg/resource/table/hooks_replica_updates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors"
88
ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
99

10-
"github.com/aws/aws-sdk-go-v2/aws"
1110
"github.com/aws-controllers-k8s/dynamodb-controller/apis/v1alpha1"
11+
"github.com/aws/aws-sdk-go-v2/aws"
1212
svcsdk "github.com/aws/aws-sdk-go-v2/service/dynamodb"
1313
svcsdktypes "github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
1414
)

pkg/resource/table/sdk.go

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/hooks/table/sdk_create_post_set_output.go.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
}
66
// Check if replicas were specified during creation
77
if desired.ko.Spec.Replicas != nil && len(desired.ko.Spec.Replicas) > 0 {
8-
// Copy the replica configuration to the new resource
98
ko.Spec.Replicas = desired.ko.Spec.Replicas
109
1110
// Return with a requeue to process replica updates

templates/hooks/table/sdk_delete_pre_build_request.go.tpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@
77

88
// If there are replicas, we need to remove them before deleting the table
99
if r.ko.Spec.Replicas != nil && len(r.ko.Spec.Replicas) > 0 {
10-
// Create a desired state with no replicas
1110
desired := &resource{
1211
ko: r.ko.DeepCopy(),
1312
}
1413
desired.ko.Spec.Replicas = nil
1514

16-
// Call syncReplicaUpdates to remove all replicas
1715
err := rm.syncReplicaUpdates(ctx, r, desired)
1816
if err != nil {
19-
if err == requeueWaitWhileUpdating {
20-
// This is expected - we need to wait for the replica removal to complete
21-
return nil, err
22-
}
2317
return nil, err
2418
}
2519
}

templates/hooks/table/sdk_read_one_post_set_output.go.tpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@
8080
} else {
8181
f12elem.ReplicaInaccessibleDateTime = nil
8282
}
83-
if f12iter.ReplicaTableClassSummary != nil && f12iter.ReplicaTableClassSummary.TableClass != "" {
84-
f12elem.ReplicaTableClassSummary.TableClass = aws.String(string(f12iter.ReplicaTableClassSummary.TableClass))
85-
f12elem.ReplicaTableClassSummary.LastUpdateDateTime = &metav1.Time{Time: *f12iter.ReplicaTableClassSummary.LastUpdateDateTime}
86-
} else {
87-
f12elem.ReplicaTableClassSummary.TableClass = aws.String("STANDARD")
88-
}
8983
f12 = append(f12, f12elem)
9084
}
9185
ko.Status.ReplicasDescriptions = f12
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: dynamodb.services.k8s.aws/v1alpha1
2+
kind: Table
3+
metadata:
4+
name: $TABLE_NAME
5+
spec:
6+
tableName: $TABLE_NAME
7+
tableClass: STANDARD
8+
attributeDefinitions:
9+
- attributeName: PK
10+
attributeType: S
11+
- attributeName: SK
12+
attributeType: S
13+
keySchema:
14+
- attributeName: PK
15+
keyType: HASH
16+
- attributeName: SK
17+
keyType: RANGE
18+
streamSpecification:
19+
streamEnabled: true
20+
streamViewType: "NEW_AND_OLD_IMAGES"
21+
replicas:
22+
- regionName: $REPLICA_REGION_1

0 commit comments

Comments
 (0)