-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(redshift): unit tests for cluster parameter change reboot handler #27788
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just want some details on one of the tests.
test('retries if rebootCluster throws generic error', async () => { | ||
// GIVEN | ||
mockDescribeClusters.mockImplementation(() => { | ||
return { | ||
Clusters: [{ | ||
ClusterParameterGroups: [{ | ||
ParameterGroupName: 'parameter-group-name', | ||
ParameterApplyStatus: 'pending-reboot', | ||
}], | ||
}], | ||
}; | ||
}); | ||
mockRebootCluster.mockImplementation(async () => { | ||
return Promise.reject(new Error('error')); | ||
}); | ||
|
||
const event: Partial<AWSLambda.CloudFormationCustomResourceEvent> = { | ||
RequestType: 'Create', | ||
ResourceProperties: { | ||
ServiceToken: 'service-token', | ||
ClusterId: 'cluster-id', | ||
ParameterGroupName: 'parameter-group-name', | ||
}, | ||
}; | ||
|
||
// WHEN | ||
// THEN | ||
await expect(() => invokeHandler(event)).rejects.toThrow('error'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on this test? How is this retrying? It looks like it is just failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I gave the wrong description.
Thanks for the hint 💪
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Closes #27730.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license