Skip to content
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

Added tests for CDK #22

Closed
wants to merge 12 commits into from
Closed

Added tests for CDK #22

wants to merge 12 commits into from

Conversation

bshien
Copy link
Collaborator

@bshien bshien commented Apr 9, 2024

Description

Describe what this change achieves.

Created/added to tests for CDK

Issues Resolved

List any issues this PR will resolve, e.g. Closes [...].

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

bshien and others added 6 commits April 9, 2024 12:21
Signed-off-by: Brandon Shien <[email protected]>
Signed-off-by: Prudhvi Godithi <[email protected]>
Rebase to add DCO
Signed-off-by: Prudhvi Godithi <[email protected]>
Signed-off-by: Brandon Shien <[email protected]>
Signed-off-by: Prudhvi Godithi <[email protected]>
Rebase for add endpoint for Cognito and enable WAF
@@ -16,6 +16,7 @@ jobs:

- name: Run CDK Test
run: |
./gradlew clean build
Copy link
Collaborator

Choose a reason for hiding this comment

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

You dont need ./gradlew clean build for CDK tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm fairly sure it was failing just now before I added it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let me try

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see now, you have a new test added test/workflow-stack.test.ts that asserts for opensearch-metrics-1.0.zip which is only created when called ./gradlew clean build.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, I wasn't asserting for the file but once that object is created something eventually depends on that zip.

@prudhvigodithi
Copy link
Collaborator

@bshien please update the PR to a better title that can justify the contribution.

@bshien bshien changed the title Metrics Added tests for CDK Apr 9, 2024
});
const hostedZoneStackTemplate = Template.fromStack(hostedZoneStack);
hostedZoneStackTemplate.resourceCountIs('AWS::Route53::HostedZone', 1);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add more assertions if the hosted zone is created as metrics.login.opensearch.org and metrics.opensearch.org. Try asserting if an a record is created or not as well

hostedZone: Project.METRICS_HOSTED_ZONE,
appName: "OpenSearchMetrics"
});
const stack = new OpenSearchMetricsNginxReadonly(app, 'Test-OpenSearchMetricsNginxReadonly', {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add more assertions for Nginx in class OpenSearchMetricsNginxCognito from opensearchNginxProxyCognito.ts.

@@ -27,4 +21,7 @@ test('OpenSearchDomain Stack Test', () => {
});
const openSearchDomainStackTemplate = Template.fromStack(openSearchDomainStack);
openSearchDomainStackTemplate.resourceCountIs('AWS::IAM::Role', 8);
openSearchDomainStackTemplate.resourceCountIs('AWS::Cognito::UserPool', 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you assert if the userpool has the right authenticated and un-authenticated role? also assert for created admin group.

lambdaPackage: Project.LAMBDA_PACKAGE
});
const template = Template.fromStack(OpenSearchMetricsWorkflow);
template.resourceCountIs('AWS::Lambda::Function', 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you assert what the lambda handler is ? add more assertions related to step functions as well.

@prudhvigodithi
Copy link
Collaborator

Closing this favor of #24.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants