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

Validate cloudwatch2 registry using localstack #4979

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sullis
Copy link

@sullis sullis commented Apr 21, 2024

this PR uses the testcontainers-localstack module

https://java.testcontainers.org/modules/localstack/

@sullis sullis force-pushed the sean/cloudwatch2-localstack branch 4 times, most recently from 38acc5c to dfc9c72 Compare April 21, 2024 16:56
@sullis sullis force-pushed the sean/cloudwatch2-localstack branch from dfc9c72 to 670574d Compare April 21, 2024 17:19
@sullis
Copy link
Author

sullis commented Apr 21, 2024

Ready for review

@shakuzen
Copy link
Member

Thank you for the pull request. This is something we've been wanting to do for a long time, and this looks like it should be a good approach.

@shakuzen shakuzen added registry: cloudwatch A CloudWatch Registry related issue type: task A general task labels Apr 22, 2024
Copy link
Member

@jonatan-ivanov jonatan-ivanov left a comment

Choose a reason for hiding this comment

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

Thank you for the PR, we definitely would like to have more integration tests!

Though I think in this form this might not be a real integration test yet or I might misunderstand what is happening here.

As the PR looks right now, I don’t get why localstack is needed. It seems verification happens against the mock (spy) so wether there was an http API call to CloudWatch (what would make this an integration test) is irrelevant from the test's point of view.

I think in order to make this an integration test and justify the usage of localstack, the test should call the AWS SDK to check if the published data is in localstack (CloudWatch) or not otherwise this could be a unit test with a different mocked/fake client without localstack (we might already have that kind of tests).

Could you please check if you can call the same cloudwatch client to get the data that was published by the registry and run verification against that data?

@@ -95,7 +95,8 @@ assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
awaitility = { module = "org.awaitility:awaitility", version.ref = "awaitility" }
aws-javaSdkCloudwatch = { module = "com.amazonaws:aws-java-sdk-cloudwatch", version.ref = "aws-cloudwatch" }
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
cloudwatch2 = { module = "software.amazon.awssdk:cloudwatch", version.ref = "cloudwatch2" }
cloudwatch2 = { module = "software.amazon.awssdk:cloudwatch", version.ref = "awsSdk2" }
awsSdk2NettyClient = { module = "software.amazon.awssdk:netty-nio-client", version.ref = "awsSdk2" }
Copy link
Member

Choose a reason for hiding this comment

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

Can't we use the default client shipped with the cloudwatch dependency?

@@ -8,4 +8,7 @@ dependencies {

testImplementation project(':micrometer-test')
testImplementation(libs.mockitoCore)
testImplementation(libs.testcontainers.localstack)
testImplementation(libs.awsSdk2NettyClient)
testImplementation(libs.logbackLatest)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
registry: cloudwatch A CloudWatch Registry related issue type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants