Skip to content

Conversation

@nmvk
Copy link
Contributor

@nmvk nmvk commented Oct 12, 2021

Declarative tests for ScaleUpAndDown and fixes for Async rollback.

Upon Async rollback we would set the terminal condition to notify the user about the rollback. This would allow user to take the necessary action.

 Conditions:
    Last Transition Time:  2021-11-23T11:45:48Z
    Message:               replication group currently being modified. cannot delete.
    Status:                False
    Type:                  ACK.ResourceSynced
    Message:               InvalidParameterCombination: Cannot update CacheNodeType, Refer to Events for more details
    Status:                True
    Type:                  ACK.Terminal

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@kumargauravsharma kumargauravsharma self-requested a review October 12, 2021 18:20
@nmvk nmvk force-pushed the e2e-cme branch 3 times, most recently from 6f92804 to e0f8511 Compare October 13, 2021 17:17
apiVersion: $CRD_GROUP/$CRD_VERSION
kind: ReplicationGroup
metadata:
name: test$RANDOM_SUFFIX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the name matches the scenario, it helps in debugging using cli later in case of failure.
Please consider names such as: cmd-dec-rep-$RANDOM_SUFFIX for this scenario

Comment on lines 22 to 24
primaryAvailabilityZone: "us-west-2b"
replicaAvailabilityZones:
- "us-west-2c"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider supplying these as replacement parameters. It will help in running the scenarios for other Region, AZ with minimal changes.

Comment on lines 37 to 44
scenario_files = sorted(os.listdir(scenarios_directory))
for scenario_file in scenario_files:
scenario_file_full_path = join(scenarios_directory, scenario_file)
if isdir(scenario_file_full_path):
for nested_scenario_file in sorted(os.listdir(scenario_file_full_path)):
scenario_files.append(join(scenario_file, nested_scenario_file))
continue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using glob.glob(scenarios_directory + '**/*.yaml', recursive=True).

@vijtrip2
Copy link
Contributor

/test elasticache-kind-e2e

@nmvk nmvk force-pushed the e2e-cme branch 3 times, most recently from 1cb5156 to 95c671f Compare October 21, 2021 03:23
Declarative tests for  ScaleUpAndDown.
@nmvk nmvk force-pushed the e2e-cme branch 4 times, most recently from 324ccda to 196496e Compare November 24, 2021 19:37
@nmvk nmvk changed the title Declarative Tests for Scaling Declarative Tests for ScalingUpAndDown and Async rollback fixes Nov 24, 2021
@nmvk nmvk force-pushed the e2e-cme branch 5 times, most recently from f2418f3 to 0f83142 Compare November 25, 2021 05:04
@nmvk
Copy link
Contributor Author

nmvk commented Nov 29, 2021

/retest

// This means that we have already attempted to apply the CacheNodeType once and
// were not successful hence we will set a terminal condition.
if !cacheNodeTypeRequiresUpdate(desired) && delta.DifferentAt("Spec.CacheNodeType") {
return nil, awserr.New("InvalidParameterCombination", "Cannot update CacheNodeType, "+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you are using awserr.New and not errors.New ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handles setting terminal codes correctly. Terminal codes are set using awsErr.Code()

return input
}

// cacheNodeTypeRequiresUpdate retrieves the last requested cacheNodeType saved in annotations and compares them
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i understand well there will always be only on cacheNodeType saved in the AnnotationLastRequestedCNT and not multiple ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct

@nmvk nmvk force-pushed the e2e-cme branch 2 times, most recently from b4f4cd4 to 69c1925 Compare November 30, 2021 23:17
@nmvk
Copy link
Contributor Author

nmvk commented Dec 1, 2021

/retest

Comment on lines +82 to +83
// Keep the value of desired for CacheNodeType.
ko.Spec.CacheNodeType = r.ko.Spec.CacheNodeType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be moved to customSetOutput instead?

desiredNodeGroupConfig := desired.ko.Spec.NodeGroupConfiguration
if val, ok := annotations[AnnotationLastRequestedNGC]; ok && val != "null" {
_ = json.Unmarshal([]byte(val), &desiredNodeGroupConfig)
return !reflect.DeepEqual(desiredNodeGroupConfig, val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could delta APIs be used here instead of reflect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the reflect in delta.go

@ack-bot
Copy link
Collaborator

ack-bot commented Dec 1, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kumargauravsharma, nmvk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [kumargauravsharma,nmvk]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Handle scaling in/out, Scaling up/down rollback
fixes.
@nmvk nmvk force-pushed the e2e-cme branch 4 times, most recently from 7b1a50b to d065d72 Compare December 2, 2021 21:46
Delta was not getting generated for the
NodeGroupConfiguration this resulted in
Test failure.
@nmvk
Copy link
Contributor Author

nmvk commented Dec 3, 2021

/retest

3 similar comments
@nmvk
Copy link
Contributor Author

nmvk commented Dec 3, 2021

/retest

@nmvk
Copy link
Contributor Author

nmvk commented Dec 4, 2021

/retest

@nmvk
Copy link
Contributor Author

nmvk commented Dec 5, 2021

/retest

With many tests, timeout needs to be
increased to avoid random failures.
@kumargauravsharma
Copy link
Contributor

e2e tests have passed. merging the changes.

@kumargauravsharma kumargauravsharma merged commit 5b1314a into aws-controllers-k8s:main Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants