diff --git a/pkg/resource/acl/hooks.go b/pkg/resource/acl/hooks.go index 1dd9ab1..b6757e2 100644 --- a/pkg/resource/acl/hooks.go +++ b/pkg/resource/acl/hooks.go @@ -122,8 +122,8 @@ func computeTagsDelta( if !equalStrings(latestElement.Value, desiredElement.Value) { addedOrUpdated = append(addedOrUpdated, desiredElement) } - continue } + continue } removed = append(removed, latestElement.Key) } diff --git a/pkg/resource/cluster/hooks.go b/pkg/resource/cluster/hooks.go index 7baaa24..98b06c8 100644 --- a/pkg/resource/cluster/hooks.go +++ b/pkg/resource/cluster/hooks.go @@ -345,8 +345,8 @@ func computeTagsDelta( if !equalStrings(latestElement.Value, desiredElement.Value) { addedOrUpdated = append(addedOrUpdated, desiredElement) } - continue } + continue } removed = append(removed, latestElement.Key) } diff --git a/pkg/resource/parameter_group/hooks.go b/pkg/resource/parameter_group/hooks.go index a94585e..6cb6ff1 100644 --- a/pkg/resource/parameter_group/hooks.go +++ b/pkg/resource/parameter_group/hooks.go @@ -15,6 +15,7 @@ package parameter_group import ( "context" + ackutil "github.com/aws-controllers-k8s/runtime/pkg/util" ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" @@ -173,13 +174,7 @@ func (rm *resourceManager) getTags( if err != nil { return nil, err } - tags := make([]*svcapitypes.Tag, 0, len(resp.TagList)) - for _, tag := range resp.TagList { - tags = append(tags, &svcapitypes.Tag{ - Key: tag.Key, - Value: tag.Value, - }) - } + tags := resourceTagsFromSDKTags(resp.TagList) return tags, nil } @@ -235,34 +230,27 @@ func (rm *resourceManager) updateTags( func computeTagsDelta( desired []*svcapitypes.Tag, latest []*svcapitypes.Tag, -) (added []*svcapitypes.Tag, removed []*string) { - toDelete := []*string{} - toAdd := []*svcapitypes.Tag{} - - desiredTags := map[string]string{} - key := "" - value := "" - for _, tag := range desired { - if tag.Key != nil { - key = *tag.Key - value = "" - if tag.Value != nil { - value = *tag.Value +) (addedOrUpdated []*svcapitypes.Tag, removed []*string) { + var visitedIndexes []string + + for _, latestElement := range latest { + visitedIndexes = append(visitedIndexes, *latestElement.Key) + for _, desiredElement := range desired { + if equalStrings(latestElement.Key, desiredElement.Key) { + if !equalStrings(latestElement.Value, desiredElement.Value) { + addedOrUpdated = append(addedOrUpdated, desiredElement) + } } - desiredTags[key] = value + continue } + removed = append(removed, latestElement.Key) } - - for _, tag := range desired { - toAdd = append(toAdd, tag) - } - for _, tag := range latest { - _, ok := desiredTags[*tag.Key] - if !ok { - toDelete = append(toDelete, tag.Key) + for _, desiredElement := range desired { + if !ackutil.InStrings(*desiredElement.Key, visitedIndexes) { + addedOrUpdated = append(addedOrUpdated, desiredElement) } } - return toAdd, toDelete + return addedOrUpdated, removed } func sdkTagsFromResourceTags( @@ -277,3 +265,23 @@ func sdkTagsFromResourceTags( } return tags } + +func resourceTagsFromSDKTags( + sdkTags []*svcsdk.Tag, +) []*svcapitypes.Tag { + tags := make([]*svcapitypes.Tag, len(sdkTags)) + for i := range sdkTags { + tags[i] = &svcapitypes.Tag{ + Key: sdkTags[i].Key, + Value: sdkTags[i].Value, + } + } + return tags +} + +func equalStrings(a, b *string) bool { + if a == nil { + return b == nil || *b == "" + } + return (*a == "" && b == nil) || *a == *b +} diff --git a/pkg/resource/snapshot/hooks.go b/pkg/resource/snapshot/hooks.go index 6c5f5d5..810337e 100644 --- a/pkg/resource/snapshot/hooks.go +++ b/pkg/resource/snapshot/hooks.go @@ -17,16 +17,29 @@ import ( "context" "errors" - svcsdk "github.com/aws/aws-sdk-go/service/memorydb" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - svcapitypes "github.com/aws-controllers-k8s/memorydb-controller/apis/v1alpha1" ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" + ackrequeue "github.com/aws-controllers-k8s/runtime/pkg/requeue" ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" ackutil "github.com/aws-controllers-k8s/runtime/pkg/util" + svcsdk "github.com/aws/aws-sdk-go/service/memorydb" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + svcapitypes "github.com/aws-controllers-k8s/memorydb-controller/apis/v1alpha1" +) + +var ( + condMsgCurrentlyDeleting string = "snapshot currently being deleted" + deleteStatus string = "deleting" +) + +var ( + requeueWaitWhileDeleting = ackrequeue.NeededAfter( + errors.New("delete is in progress"), + ackrequeue.DefaultRequeueAfterDuration, + ) ) func (rm *resourceManager) customDescribeSnapshotSetOutput( @@ -248,6 +261,131 @@ func (rm *resourceManager) newCopySnapshotPayload( return res, nil } +// isDeleting returns true if supplied snapshot resource state is 'deleting' +func isDeleting(r *resource) bool { + if r == nil || r.ko.Status.Status == nil { + return false + } + status := *r.ko.Status.Status + return status == deleteStatus +} + +func (rm *resourceManager) setSnapshotOutput( + r *resource, + obj *svcsdk.Snapshot, +) (*resource, error) { + if obj == nil || + r == nil || + r.ko == nil { + return nil, nil + } + resp := &svcsdk.DeleteSnapshotOutput{Snapshot: obj} + + // Merge in the information we read from the API call above to the copy of + // the original Kubernetes object we passed to the function + ko := r.ko.DeepCopy() + + if ko.Status.ACKResourceMetadata == nil { + ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} + } + if resp.Snapshot.ARN != nil { + arn := ackv1alpha1.AWSResourceName(*resp.Snapshot.ARN) + ko.Status.ACKResourceMetadata.ARN = &arn + } + if resp.Snapshot.ClusterConfiguration != nil { + f1 := &svcapitypes.ClusterConfiguration{} + if resp.Snapshot.ClusterConfiguration.Description != nil { + f1.Description = resp.Snapshot.ClusterConfiguration.Description + } + if resp.Snapshot.ClusterConfiguration.EngineVersion != nil { + f1.EngineVersion = resp.Snapshot.ClusterConfiguration.EngineVersion + } + if resp.Snapshot.ClusterConfiguration.MaintenanceWindow != nil { + f1.MaintenanceWindow = resp.Snapshot.ClusterConfiguration.MaintenanceWindow + } + if resp.Snapshot.ClusterConfiguration.Name != nil { + f1.Name = resp.Snapshot.ClusterConfiguration.Name + } + if resp.Snapshot.ClusterConfiguration.NodeType != nil { + f1.NodeType = resp.Snapshot.ClusterConfiguration.NodeType + } + if resp.Snapshot.ClusterConfiguration.NumShards != nil { + f1.NumShards = resp.Snapshot.ClusterConfiguration.NumShards + } + if resp.Snapshot.ClusterConfiguration.ParameterGroupName != nil { + f1.ParameterGroupName = resp.Snapshot.ClusterConfiguration.ParameterGroupName + } + if resp.Snapshot.ClusterConfiguration.Port != nil { + f1.Port = resp.Snapshot.ClusterConfiguration.Port + } + if resp.Snapshot.ClusterConfiguration.Shards != nil { + f1f8 := []*svcapitypes.ShardDetail{} + for _, f1f8iter := range resp.Snapshot.ClusterConfiguration.Shards { + f1f8elem := &svcapitypes.ShardDetail{} + if f1f8iter.Configuration != nil { + f1f8elemf0 := &svcapitypes.ShardConfiguration{} + if f1f8iter.Configuration.ReplicaCount != nil { + f1f8elemf0.ReplicaCount = f1f8iter.Configuration.ReplicaCount + } + if f1f8iter.Configuration.Slots != nil { + f1f8elemf0.Slots = f1f8iter.Configuration.Slots + } + f1f8elem.Configuration = f1f8elemf0 + } + if f1f8iter.Name != nil { + f1f8elem.Name = f1f8iter.Name + } + if f1f8iter.Size != nil { + f1f8elem.Size = f1f8iter.Size + } + if f1f8iter.SnapshotCreationTime != nil { + f1f8elem.SnapshotCreationTime = &metav1.Time{*f1f8iter.SnapshotCreationTime} + } + f1f8 = append(f1f8, f1f8elem) + } + f1.Shards = f1f8 + } + if resp.Snapshot.ClusterConfiguration.SnapshotRetentionLimit != nil { + f1.SnapshotRetentionLimit = resp.Snapshot.ClusterConfiguration.SnapshotRetentionLimit + } + if resp.Snapshot.ClusterConfiguration.SnapshotWindow != nil { + f1.SnapshotWindow = resp.Snapshot.ClusterConfiguration.SnapshotWindow + } + if resp.Snapshot.ClusterConfiguration.SubnetGroupName != nil { + f1.SubnetGroupName = resp.Snapshot.ClusterConfiguration.SubnetGroupName + } + if resp.Snapshot.ClusterConfiguration.TopicArn != nil { + f1.TopicARN = resp.Snapshot.ClusterConfiguration.TopicArn + } + if resp.Snapshot.ClusterConfiguration.VpcId != nil { + f1.VPCID = resp.Snapshot.ClusterConfiguration.VpcId + } + ko.Status.ClusterConfiguration = f1 + } else { + ko.Status.ClusterConfiguration = nil + } + if resp.Snapshot.KmsKeyId != nil { + ko.Spec.KMSKeyID = resp.Snapshot.KmsKeyId + } else { + ko.Spec.KMSKeyID = nil + } + if resp.Snapshot.Source != nil { + ko.Status.Source = resp.Snapshot.Source + } else { + ko.Status.Source = nil + } + if resp.Snapshot.Status != nil { + ko.Status.Status = resp.Snapshot.Status + } else { + ko.Status.Status = nil + } + + rm.setStatusDefaults(ko) + // custom set output from response + rm.customSetOutput(obj, ko) + return &resource{ko}, nil +} + // getTags gets tags from given ParameterGroup. func (rm *resourceManager) getTags( ctx context.Context, @@ -346,8 +484,8 @@ func computeTagsDelta( if !equalStrings(latestElement.Value, desiredElement.Value) { addedOrUpdated = append(addedOrUpdated, desiredElement) } - continue } + continue } removed = append(removed, latestElement.Key) } diff --git a/pkg/resource/snapshot/utility.go b/pkg/resource/snapshot/utility.go deleted file mode 100644 index 0549542..0000000 --- a/pkg/resource/snapshot/utility.go +++ /dev/null @@ -1,147 +0,0 @@ -package snapshot - -import ( - "errors" - svcapitypes "github.com/aws-controllers-k8s/memorydb-controller/apis/v1alpha1" - ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" - ackrequeue "github.com/aws-controllers-k8s/runtime/pkg/requeue" - svcsdk "github.com/aws/aws-sdk-go/service/memorydb" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -var ( - condMsgCurrentlyDeleting string = "snapshot currently being deleted" - deleteStatus string = "deleting" -) - -var ( - requeueWaitWhileDeleting = ackrequeue.NeededAfter( - errors.New("delete is in progress"), - ackrequeue.DefaultRequeueAfterDuration, - ) -) - -// isDeleting returns true if supplied snapshot resource state is 'deleting' -func isDeleting(r *resource) bool { - if r == nil || r.ko.Status.Status == nil { - return false - } - status := *r.ko.Status.Status - return status == deleteStatus -} - -func (rm *resourceManager) setSnapshotOutput( - r *resource, - obj *svcsdk.Snapshot, -) (*resource, error) { - if obj == nil || - r == nil || - r.ko == nil { - return nil, nil - } - resp := &svcsdk.DeleteSnapshotOutput{Snapshot: obj} - - // Merge in the information we read from the API call above to the copy of - // the original Kubernetes object we passed to the function - ko := r.ko.DeepCopy() - - if ko.Status.ACKResourceMetadata == nil { - ko.Status.ACKResourceMetadata = &ackv1alpha1.ResourceMetadata{} - } - if resp.Snapshot.ARN != nil { - arn := ackv1alpha1.AWSResourceName(*resp.Snapshot.ARN) - ko.Status.ACKResourceMetadata.ARN = &arn - } - if resp.Snapshot.ClusterConfiguration != nil { - f1 := &svcapitypes.ClusterConfiguration{} - if resp.Snapshot.ClusterConfiguration.Description != nil { - f1.Description = resp.Snapshot.ClusterConfiguration.Description - } - if resp.Snapshot.ClusterConfiguration.EngineVersion != nil { - f1.EngineVersion = resp.Snapshot.ClusterConfiguration.EngineVersion - } - if resp.Snapshot.ClusterConfiguration.MaintenanceWindow != nil { - f1.MaintenanceWindow = resp.Snapshot.ClusterConfiguration.MaintenanceWindow - } - if resp.Snapshot.ClusterConfiguration.Name != nil { - f1.Name = resp.Snapshot.ClusterConfiguration.Name - } - if resp.Snapshot.ClusterConfiguration.NodeType != nil { - f1.NodeType = resp.Snapshot.ClusterConfiguration.NodeType - } - if resp.Snapshot.ClusterConfiguration.NumShards != nil { - f1.NumShards = resp.Snapshot.ClusterConfiguration.NumShards - } - if resp.Snapshot.ClusterConfiguration.ParameterGroupName != nil { - f1.ParameterGroupName = resp.Snapshot.ClusterConfiguration.ParameterGroupName - } - if resp.Snapshot.ClusterConfiguration.Port != nil { - f1.Port = resp.Snapshot.ClusterConfiguration.Port - } - if resp.Snapshot.ClusterConfiguration.Shards != nil { - f1f8 := []*svcapitypes.ShardDetail{} - for _, f1f8iter := range resp.Snapshot.ClusterConfiguration.Shards { - f1f8elem := &svcapitypes.ShardDetail{} - if f1f8iter.Configuration != nil { - f1f8elemf0 := &svcapitypes.ShardConfiguration{} - if f1f8iter.Configuration.ReplicaCount != nil { - f1f8elemf0.ReplicaCount = f1f8iter.Configuration.ReplicaCount - } - if f1f8iter.Configuration.Slots != nil { - f1f8elemf0.Slots = f1f8iter.Configuration.Slots - } - f1f8elem.Configuration = f1f8elemf0 - } - if f1f8iter.Name != nil { - f1f8elem.Name = f1f8iter.Name - } - if f1f8iter.Size != nil { - f1f8elem.Size = f1f8iter.Size - } - if f1f8iter.SnapshotCreationTime != nil { - f1f8elem.SnapshotCreationTime = &metav1.Time{*f1f8iter.SnapshotCreationTime} - } - f1f8 = append(f1f8, f1f8elem) - } - f1.Shards = f1f8 - } - if resp.Snapshot.ClusterConfiguration.SnapshotRetentionLimit != nil { - f1.SnapshotRetentionLimit = resp.Snapshot.ClusterConfiguration.SnapshotRetentionLimit - } - if resp.Snapshot.ClusterConfiguration.SnapshotWindow != nil { - f1.SnapshotWindow = resp.Snapshot.ClusterConfiguration.SnapshotWindow - } - if resp.Snapshot.ClusterConfiguration.SubnetGroupName != nil { - f1.SubnetGroupName = resp.Snapshot.ClusterConfiguration.SubnetGroupName - } - if resp.Snapshot.ClusterConfiguration.TopicArn != nil { - f1.TopicARN = resp.Snapshot.ClusterConfiguration.TopicArn - } - if resp.Snapshot.ClusterConfiguration.VpcId != nil { - f1.VPCID = resp.Snapshot.ClusterConfiguration.VpcId - } - ko.Status.ClusterConfiguration = f1 - } else { - ko.Status.ClusterConfiguration = nil - } - if resp.Snapshot.KmsKeyId != nil { - ko.Spec.KMSKeyID = resp.Snapshot.KmsKeyId - } else { - ko.Spec.KMSKeyID = nil - } - if resp.Snapshot.Source != nil { - ko.Status.Source = resp.Snapshot.Source - } else { - ko.Status.Source = nil - } - if resp.Snapshot.Status != nil { - ko.Status.Status = resp.Snapshot.Status - } else { - ko.Status.Status = nil - } - - rm.setStatusDefaults(ko) - // custom set output from response - rm.customSetOutput(obj, ko) - return &resource{ko}, nil -} diff --git a/pkg/resource/subnet_group/hooks.go b/pkg/resource/subnet_group/hooks.go index 5dcc19a..16f8b6b 100644 --- a/pkg/resource/subnet_group/hooks.go +++ b/pkg/resource/subnet_group/hooks.go @@ -15,6 +15,7 @@ package subnet_group import ( "context" + ackutil "github.com/aws-controllers-k8s/runtime/pkg/util" svcapitypes "github.com/aws-controllers-k8s/memorydb-controller/apis/v1alpha1" ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" @@ -36,13 +37,7 @@ func (rm *resourceManager) getTags( if err != nil { return nil, err } - tags := make([]*svcapitypes.Tag, 0, len(resp.TagList)) - for _, tag := range resp.TagList { - tags = append(tags, &svcapitypes.Tag{ - Key: tag.Key, - Value: tag.Value, - }) - } + tags := resourceTagsFromSDKTags(resp.TagList) return tags, nil } @@ -98,34 +93,27 @@ func (rm *resourceManager) updateTags( func computeTagsDelta( desired []*svcapitypes.Tag, latest []*svcapitypes.Tag, -) (added []*svcapitypes.Tag, removed []*string) { - toDelete := []*string{} - toAdd := []*svcapitypes.Tag{} +) (addedOrUpdated []*svcapitypes.Tag, removed []*string) { + var visitedIndexes []string - desiredTags := map[string]string{} - key := "" - value := "" - for _, tag := range desired { - if tag.Key != nil { - key = *tag.Key - value = "" - if tag.Value != nil { - value = *tag.Value + for _, latestElement := range latest { + visitedIndexes = append(visitedIndexes, *latestElement.Key) + for _, desiredElement := range desired { + if equalStrings(latestElement.Key, desiredElement.Key) { + if !equalStrings(latestElement.Value, desiredElement.Value) { + addedOrUpdated = append(addedOrUpdated, desiredElement) + } } - desiredTags[key] = value + continue } + removed = append(removed, latestElement.Key) } - - for _, tag := range desired { - toAdd = append(toAdd, tag) - } - for _, tag := range latest { - _, ok := desiredTags[*tag.Key] - if !ok { - toDelete = append(toDelete, tag.Key) + for _, desiredElement := range desired { + if !ackutil.InStrings(*desiredElement.Key, visitedIndexes) { + addedOrUpdated = append(addedOrUpdated, desiredElement) } } - return toAdd, toDelete + return addedOrUpdated, removed } func sdkTagsFromResourceTags( @@ -140,3 +128,23 @@ func sdkTagsFromResourceTags( } return tags } + +func resourceTagsFromSDKTags( + sdkTags []*svcsdk.Tag, +) []*svcapitypes.Tag { + tags := make([]*svcapitypes.Tag, len(sdkTags)) + for i := range sdkTags { + tags[i] = &svcapitypes.Tag{ + Key: sdkTags[i].Key, + Value: sdkTags[i].Value, + } + } + return tags +} + +func equalStrings(a, b *string) bool { + if a == nil { + return b == nil || *b == "" + } + return (*a == "" && b == nil) || *a == *b +} diff --git a/pkg/resource/user/hooks.go b/pkg/resource/user/hooks.go index 8a774a5..8ac230b 100644 --- a/pkg/resource/user/hooks.go +++ b/pkg/resource/user/hooks.go @@ -142,8 +142,8 @@ func computeTagsDelta( if !equalStrings(latestElement.Value, desiredElement.Value) { addedOrUpdated = append(addedOrUpdated, desiredElement) } - continue } + continue } removed = append(removed, latestElement.Key) } diff --git a/test/e2e/bootstrap_resources.py b/test/e2e/bootstrap_resources.py index 941dbeb..0df4938 100644 --- a/test/e2e/bootstrap_resources.py +++ b/test/e2e/bootstrap_resources.py @@ -35,6 +35,7 @@ class BootstrapResources(Resources): KMSKey: KMS Cluster1: Cluster Cluster2: Cluster + Cluster3: Cluster _bootstrap_resources = None diff --git a/test/e2e/replacement_values.py b/test/e2e/replacement_values.py index 8085a20..4f5cb97 100644 --- a/test/e2e/replacement_values.py +++ b/test/e2e/replacement_values.py @@ -24,5 +24,6 @@ "TOPIC2": get_bootstrap_resources().Topic2.topic_arn, "KMSKEY": get_bootstrap_resources().KMSKey.key, "SNAPSHOT_CLUSTER_NAME1": get_bootstrap_resources().Cluster1.clusterName, - "SNAPSHOT_CLUSTER_NAME2": get_bootstrap_resources().Cluster2.clusterName + "SNAPSHOT_CLUSTER_NAME2": get_bootstrap_resources().Cluster2.clusterName, + "SNAPSHOT_CLUSTER_NAME3": get_bootstrap_resources().Cluster3.clusterName } diff --git a/test/e2e/scenarios/ACL/acl_terminal_condition.yaml b/test/e2e/scenarios/ACL/acl_terminal_condition.yaml index 711b7a0..a2fc80b 100644 --- a/test/e2e/scenarios/ACL/acl_terminal_condition.yaml +++ b/test/e2e/scenarios/ACL/acl_terminal_condition.yaml @@ -4,15 +4,15 @@ description: "In this test we create User and create/update ACL to validate term # - slow # - blocked steps: - - id: "USER_ONE_CREATE" - description: "Create User One" + - id: "USER_CREATE" + description: "Create User" create: apiVersion: $CRD_GROUP/$CRD_VERSION kind: User metadata: - name: userone$RANDOM_SUFFIX + name: user$RANDOM_SUFFIX spec: - name: userone$RANDOM_SUFFIX + name: user$RANDOM_SUFFIX accessString: on +get authenticationMode: type_: password @@ -42,7 +42,7 @@ steps: ACK.Terminal: status: "True" timeout: 180 - - id: "UPDATE_ACL" + - id: "UPDATE_ACL_VALID" description: "Update userNames" patch: apiVersion: $CRD_GROUP/$CRD_VERSION @@ -51,14 +51,14 @@ steps: name: acl$RANDOM_SUFFIX spec: userNames: - - userone$RANDOM_SUFFIX + - user$RANDOM_SUFFIX wait: status: conditions: ACK.ResourceSynced: status: "True" timeout: 180 - - id: "UPDATE_ACL" + - id: "UPDATE_ACL_INVALID" description: "Update userNames to invalid" patch: apiVersion: $CRD_GROUP/$CRD_VERSION @@ -81,10 +81,10 @@ steps: kind: ACL metadata: name: acl$RANDOM_SUFFIX - - id: "USER_DELETE_ONE" - description: "Delete User one" + - id: "USER_DELETE" + description: "Delete User" delete: apiVersion: $CRD_GROUP/$CRD_VERSION kind: User metadata: - name: userone$RANDOM_SUFFIX \ No newline at end of file + name: user$RANDOM_SUFFIX \ No newline at end of file diff --git a/test/e2e/scenarios/ACL/acl_update_with_tags.yaml b/test/e2e/scenarios/ACL/acl_update_with_tags.yaml index 0b5c23c..331404a 100644 --- a/test/e2e/scenarios/ACL/acl_update_with_tags.yaml +++ b/test/e2e/scenarios/ACL/acl_update_with_tags.yaml @@ -60,7 +60,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "ACL_DELETE_TAGS" description: "Delete tags in ACL" patch: @@ -77,7 +77,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "ACL_ADD_AND_DELETE_TAGS" description: "Add some tags and delete some tags in ACL" patch: @@ -94,7 +94,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "ACL_DELETE" description: "Delete ACL" delete: diff --git a/test/e2e/scenarios/Cluster/cluster_create_update.yaml b/test/e2e/scenarios/Cluster/cluster_create_update.yaml index 13c8354..ed81b81 100644 --- a/test/e2e/scenarios/Cluster/cluster_create_update.yaml +++ b/test/e2e/scenarios/Cluster/cluster_create_update.yaml @@ -1,4 +1,4 @@ -id: "CREATE_UPDATE" +id: "CLUSTER_CREATE_UPDATE" description: "In this test we create Cluster and update it" #marks: # - slow @@ -62,16 +62,15 @@ steps: ACK.ResourceSynced: status: "True" timeout: 7200 - - - id: "USER_ONE_CREATE" - description: "Create User ONE" + - id: "USER_CREATE" + description: "Create User" create: apiVersion: $CRD_GROUP/$CRD_VERSION kind: User metadata: - name: userone$RANDOM_SUFFIX + name: user$RANDOM_SUFFIX spec: - name: userone$RANDOM_SUFFIX + name: user$RANDOM_SUFFIX accessString: on +get authenticationMode: type_: password @@ -94,14 +93,13 @@ steps: spec: name: acl$RANDOM_SUFFIX userNames: - - userone$RANDOM_SUFFIX + - user$RANDOM_SUFFIX wait: status: conditions: ACK.ResourceSynced: status: "True" - timeout: 180 - + timout: 180 - id: "UPDATE_ACL" description: "Update ACL" patch: @@ -116,8 +114,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 7200 - + timeout: 180 - id: "PG_INITIAL_CREATE" description: "PG with activerehashing as no" create: @@ -137,8 +134,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 - + timeout: 180 - id: "UPDATE_PG" description: "Update PG" patch: @@ -153,8 +149,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 7200 - + timeout: 180 - id: "DELETE_CLUSTER" description: "Delete the cluster" delete: @@ -162,7 +157,6 @@ steps: kind: Cluster metadata: name: cluster$RANDOM_SUFFIX - - id: "DELETE_PG" description: "Delete parameter group" delete: @@ -177,17 +171,10 @@ steps: kind: ACL metadata: name: acl$RANDOM_SUFFIX - - id: "USER_DELETE_ONE" - description: "Delete User one" - delete: - apiVersion: $CRD_GROUP/$CRD_VERSION - kind: User - metadata: - name: userone$RANDOM_SUFFIX - - id: "USER_DELETE_TWO" - description: "Delete User two" + - id: "USER_DELETE" + description: "Delete User" delete: apiVersion: $CRD_GROUP/$CRD_VERSION kind: User metadata: - name: usertwo$RANDOM_SUFFIX \ No newline at end of file + name: user$RANDOM_SUFFIX \ No newline at end of file diff --git a/test/e2e/scenarios/Cluster/cluster_scale_in_scale_up_increase_replica.yaml b/test/e2e/scenarios/Cluster/cluster_scale_in_scale_up_increase_replica.yaml index 5ed67dc..b477377 100644 --- a/test/e2e/scenarios/Cluster/cluster_scale_in_scale_up_increase_replica.yaml +++ b/test/e2e/scenarios/Cluster/cluster_scale_in_scale_up_increase_replica.yaml @@ -1,4 +1,4 @@ -id: "SCALE_IN_SCALE_UP_INCREASE_REPLICA" +id: "CLUSTER_SCALE_IN_SCALE_UP_INCREASE_REPLICA" description: "In this test we create Cluster and update scale in, scale up and increase replica" #marks: # - slow diff --git a/test/e2e/scenarios/Cluster/cluster_scale_out_scale_down_decrease_replica.yaml b/test/e2e/scenarios/Cluster/cluster_scale_out_scale_down_decrease_replica.yaml index 59b40de..2fa0c38 100644 --- a/test/e2e/scenarios/Cluster/cluster_scale_out_scale_down_decrease_replica.yaml +++ b/test/e2e/scenarios/Cluster/cluster_scale_out_scale_down_decrease_replica.yaml @@ -1,4 +1,4 @@ -id: "SCALE_OUT_SCALE_DOWN_DECREASE_REPLICA" +id: "CLUSTER_SCALE_OUT_SCALE_DOWN_DECREASE_REPLICA" description: "In this test we create Cluster and update scale out, scale down and decrease replica" #marks: # - slow diff --git a/test/e2e/scenarios/Snapshot/snapshot_copy.yaml b/test/e2e/scenarios/Snapshot/snapshot_copy.yaml index ef44a1b..15f6652 100644 --- a/test/e2e/scenarios/Snapshot/snapshot_copy.yaml +++ b/test/e2e/scenarios/Snapshot/snapshot_copy.yaml @@ -49,4 +49,11 @@ steps: apiVersion: $CRD_GROUP/$CRD_VERSION kind: Snapshot metadata: - name: snapshot$RANDOM_SUFFIX \ No newline at end of file + name: snapshot$RANDOM_SUFFIX + - id: "DELETE_CLUSTER" + description: "Delete cluster" + delete: + apiVersion: $CRD_GROUP/$CRD_VERSION + kind: Cluster + metadata: + name: $SNAPSHOT_CLUSTER_NAME2 \ No newline at end of file diff --git a/test/e2e/scenarios/Snapshot/snapshot_create.yaml b/test/e2e/scenarios/Snapshot/snapshot_create.yaml index d48fb88..a086b4c 100644 --- a/test/e2e/scenarios/Snapshot/snapshot_create.yaml +++ b/test/e2e/scenarios/Snapshot/snapshot_create.yaml @@ -27,3 +27,10 @@ steps: kind: Snapshot metadata: name: snapshot$RANDOM_SUFFIX + - id: "DELETE_CLUSTER" + description: "Delete cluster" + delete: + apiVersion: $CRD_GROUP/$CRD_VERSION + kind: Cluster + metadata: + name: $SNAPSHOT_CLUSTER_NAME1 \ No newline at end of file diff --git a/test/e2e/scenarios/Snapshot/snapshot_create_terminal_condition.yaml b/test/e2e/scenarios/Snapshot/snapshot_create_terminal_condition.yaml index 3441a33..1de9f16 100644 --- a/test/e2e/scenarios/Snapshot/snapshot_create_terminal_condition.yaml +++ b/test/e2e/scenarios/Snapshot/snapshot_create_terminal_condition.yaml @@ -13,11 +13,11 @@ steps: name: snapshot$RANDOM_SUFFIX spec: name: snapshot$RANDOM_SUFFIX - wait: 600 - expect: + wait: status: conditions: ACK.Terminal: "True" + timeout: 600 - id: "DELETE_SNAPSHOT" description: "Delete snapshot" delete: diff --git a/test/e2e/scenarios/Snapshot/snapshot_update_with_tags.yaml b/test/e2e/scenarios/Snapshot/snapshot_update_with_tags.yaml index e2bc00e..9909b2d 100644 --- a/test/e2e/scenarios/Snapshot/snapshot_update_with_tags.yaml +++ b/test/e2e/scenarios/Snapshot/snapshot_update_with_tags.yaml @@ -4,33 +4,15 @@ description: "In this test we create snapshot and update tags" # - slow # - blocked steps: - - id: "CLUSTER_INITIAL_CREATE" - description: "Create cluster" - create: - apiVersion: $CRD_GROUP/$CRD_VERSION - kind: Cluster - metadata: - name: cluster$RANDOM_SUFFIX - spec: - name: cluster$RANDOM_SUFFIX - nodeType: db.t4g.small - aclName: open-access - numShards: 1 - wait: - status: - conditions: - ACK.ResourceSynced: - status: "True" - timeout: 7200 - - id: "SNAPSHOT_INITIAL_CREATE" - description: "Create snapshot with no tags" + - id: "CREATE_INITIAL_SNAPSHOT" + description: "Create Initial Snapshot" create: apiVersion: $CRD_GROUP/$CRD_VERSION kind: Snapshot metadata: name: snapshot$RANDOM_SUFFIX spec: - clusterName: cluster$RANDOM_SUFFIX + clusterName: $SNAPSHOT_CLUSTER_NAME3 name: snapshot$RANDOM_SUFFIX wait: status: @@ -56,7 +38,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "SNAPSHOT_DELETE_TAGS" description: "Delete tags in snapshot" patch: @@ -73,7 +55,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "SNAPSHOT_ADD_AND_DELETE_TAGS" description: "Add some tags and delete tags in snapshot" patch: @@ -90,7 +72,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "DELETE_SNAPSHOT" description: "Delete snapshot" delete: @@ -104,4 +86,4 @@ steps: apiVersion: $CRD_GROUP/$CRD_VERSION kind: Cluster metadata: - name: cluster$RANDOM_SUFFIX \ No newline at end of file + name: $SNAPSHOT_CLUSTER_NAME3 \ No newline at end of file diff --git a/test/e2e/scenarios/User/user_create_update.yaml b/test/e2e/scenarios/User/user_create_update.yaml index bbe4f33..d2409bc 100644 --- a/test/e2e/scenarios/User/user_create_update.yaml +++ b/test/e2e/scenarios/User/user_create_update.yaml @@ -25,7 +25,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "USER_UPDATE_ACCESS_STRING" description: "Update AccessString" patch: @@ -36,7 +36,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "USER_UPDATE_PASSWORD" description: "Update Password" patch: @@ -51,7 +51,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "USER_UPDATE_ACCESS_STRING_AND_SECRET" description: "Update Secret and AccessString" patch: @@ -67,7 +67,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "REAPPLY_SPEC" description: "Update Secret and AccessString we should not see any errors" patch: @@ -83,7 +83,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "DELETE_USER" description: "Delete User" delete: user$RANDOM_SUFFIX diff --git a/test/e2e/scenarios/User/user_terminal_conditions.yaml b/test/e2e/scenarios/User/user_terminal_conditions.yaml index 311febe..553514f 100644 --- a/test/e2e/scenarios/User/user_terminal_conditions.yaml +++ b/test/e2e/scenarios/User/user_terminal_conditions.yaml @@ -25,7 +25,7 @@ steps: conditions: ACK.Terminal: status: "True" - timeout: 100 + timeout: 180 - id: "USER_UPDATE_ACCESS_STRING" description: "Update AccessString" patch: @@ -36,7 +36,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "USER_UPDATE_INCORRECT_ACCESS_STRING" description: "Update to incorrect access string" patch: @@ -47,7 +47,7 @@ steps: conditions: ACK.Terminal: status: "True" - timeout: 100 + timeout: 180 - id: "DELETE_USER" description: "Delete User" delete: user$RANDOM_SUFFIX diff --git a/test/e2e/scenarios/User/user_update_with_tags.yaml b/test/e2e/scenarios/User/user_update_with_tags.yaml index ca3caf5..c92c025 100644 --- a/test/e2e/scenarios/User/user_update_with_tags.yaml +++ b/test/e2e/scenarios/User/user_update_with_tags.yaml @@ -25,7 +25,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "USER_ADD_TAGS" description: "Add tags in User" patch: @@ -40,7 +40,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "USER_DELETE_TAGS" description: "Delete tags in User" patch: @@ -53,7 +53,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "SG_ADD_AND_DELETE_TAGS" description: "Add some tags and delete some tags in User" patch: @@ -66,7 +66,7 @@ steps: conditions: ACK.ResourceSynced: status: "True" - timeout: 100 + timeout: 180 - id: "DELETE_USER" description: "Delete User" delete: user$RANDOM_SUFFIX diff --git a/test/e2e/service_bootstrap.py b/test/e2e/service_bootstrap.py index 03a111e..47e11e3 100755 --- a/test/e2e/service_bootstrap.py +++ b/test/e2e/service_bootstrap.py @@ -36,7 +36,8 @@ def service_bootstrap() -> Resources: Topic2=Topic(), KMSKey=KMS(), Cluster1=Cluster(random_suffix_name("cluster", 10)), - Cluster2=Cluster(random_suffix_name("cluster", 10))) + Cluster2=Cluster(random_suffix_name("cluster", 10)), + Cluster3=Cluster(random_suffix_name("cluster", 10))) try: resources.bootstrap()