Skip to content

feat: s3 health check #723

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

Merged
merged 1 commit into from
May 30, 2024

Conversation

elbiocaetano
Copy link
Contributor

No description provided.

Copy link
Contributor

github-actions bot commented May 30, 2024

Next minor release will be 4.5.0, Show Release Notes

4.5.0 (2024-05-30)

Features

Copy link
Contributor

github-actions bot commented May 30, 2024

Test Results

  234 files  +2    234 suites  +2   8m 32s ⏱️ +24s
1 150 tests  - 1  1 142 ✅  - 1   8 💤 ±0  0 ❌ ±0 
2 336 runs  +6  2 316 ✅ +6  20 💤 ±0  0 ❌ ±0 

Results for commit 19b174e. ± Comparison against base commit 662ff2a.

This pull request removes 4 and adds 3 tests. Note that renamed tests count towards both.
org.sdase.commons.spring.boot.metadata.context.MetadataContextMergeIntegrationTest ‑ [4] {processes=[p-c1, p-c2], tenant-id=[t-c]}, {processes=[p-n3, p-n4], tenant-id=[]}, EXTEND, {processes=[p-c1, p-c2, p-n3, p-n4], tenant-id=[t-c]}
org.sdase.commons.spring.boot.metadata.context.MetadataContextMergeIntegrationTest ‑ [5] {tenant-id=[t-c]}, {processes=[p-n]}, EXTEND, {processes=[p-n], tenant-id=[t-c]}
org.sdase.commons.spring.boot.metadata.context.MetadataContextMergeIntegrationTest ‑ [8] {tenant-id=[t-c]}, {processes=[p-n], tenant-id=[t-n]}, KEEP, {processes=[p-n], tenant-id=[t-c]}
org.sdase.commons.spring.boot.metadata.context.MetadataContextMergeIntegrationTest ‑ [9] {processes=[p-c], tenant-id=[t-c]}, {tenant-id=[t-n]}, REPLACE, {processes=[p-c], tenant-id=[t-n]}
org.sdase.commons.spring.boot.s3.config.S3HealthIndicatorIntegrationTest ‑ checkThatS3HealthCheckIsEnabledAndDown()
org.sdase.commons.spring.boot.s3.config.S3HealthIndicatorIntegrationTest ‑ checkThatS3HealthCheckIsEnabledAndUp()
org.sdase.commons.spring.boot.s3.config.S3HealthIndicatorIntegrationTest ‑ checkThatS3HealthCheckIsNotEnabled()

♻️ This comment has been updated with latest results.

@elbiocaetano elbiocaetano force-pushed the PLP-1714-check-if-the-s-3-health-check-is-needed branch from c311c46 to 0ce08d9 Compare May 30, 2024 12:46
@elbiocaetano elbiocaetano requested a review from a team May 30, 2024 13:22
JoergSiebahn
JoergSiebahn previously approved these changes May 30, 2024
Copy link
Contributor

@JoergSiebahn JoergSiebahn left a comment

Choose a reason for hiding this comment

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

Just some comments.

Comment on lines 42 to 44
if (LOGGER.isErrorEnabled()) {
LOGGER.error(e.getMessage(), e);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Imho this can be simplified, as LOGGER.error will also suppress the message if not enabled (and error is likely always enabled). I would also go for a custom message and attach the exception, e.g. like this:

Suggested change
if (LOGGER.isErrorEnabled()) {
LOGGER.error(e.getMessage(), e);
}
LOGGER.error("S3 health check failed to get info of bucket {}", bucketName, e);

Copy link
Contributor

Choose a reason for hiding this comment

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

As the health check is propagating to the health endpoint anyways, I wonder if the log could also be a warning.

Comment on lines +29 to +33
@SetSystemProperty(key = "management.health.s3.enabled", value = "true")
@SpringBootTest(
classes = S3TestApp.class,
webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071"})
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: As this is a SpringBootTest, isn't it possible to set it as property?

Suggested change
@SetSystemProperty(key = "management.health.s3.enabled", value = "true")
@SpringBootTest(
classes = S3TestApp.class,
webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071"})
@SpringBootTest(
classes = S3TestApp.class,
webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071", "management.health.s3.enabled=true"})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately no, because otherrwise it would ovewrite the @SetSystemProperty in the checkThatS3HealthCheckIsNotEnabled test.

webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {"auth.disable=true", "opa.disable=true", "management.server.port=8071"})
@S3Test
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Can the dirty context be avoided if we don't use SetSystemProperty? Afaik, this slows down the test suite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that I want to test when it is enabled and when it is not, so I need to run the server again for each test. In order to do that I either use this approach or I separate in two test classes, one with the health check enabled, and the other one disabled.

@elbiocaetano elbiocaetano force-pushed the PLP-1714-check-if-the-s-3-health-check-is-needed branch from 0ce08d9 to 19b174e Compare May 30, 2024 14:24
@elbiocaetano elbiocaetano enabled auto-merge (squash) May 30, 2024 14:26
@elbiocaetano elbiocaetano disabled auto-merge May 30, 2024 14:53
@elbiocaetano elbiocaetano merged commit 0ca25e4 into main May 30, 2024
16 checks passed
@elbiocaetano elbiocaetano deleted the PLP-1714-check-if-the-s-3-health-check-is-needed branch May 30, 2024 14:54
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