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

chore: production code should not be test aware DHIS2-17821 #18282

Closed
wants to merge 1 commit into from

Conversation

teleivo
Copy link
Contributor

@teleivo teleivo commented Aug 2, 2024

Our use of @Conditionals was wrong IMHO. A @Configuration for some redis related beans should only care that redis is configured or not or a feature flag being enabled or not. This has nothing to do with it running inside the context of a test.

This even impeded our ability to test. This change allows us to setup redis via testcontainers. You could then easily test DHIS2s caching behavior using a controller integration test.

There is also less risk of us not executing a certain logic in production because we messed up a conditional or of how we use profiles.

There are more places like this that we will have to operate on. For example the cache provider configures itself differently or ArtemisConfig selects a random port when the test profile is active. Some of these things are already configurable by users via the dhis.conf.

https://dhis2.atlassian.net/browse/DHIS2-17797 will make setting, overriding the default dhis.conf in integration tests even easier.

@teleivo teleivo force-pushed the DHIS2-17821-conditionals branch 2 times, most recently from 9d62777 to c6169bc Compare August 2, 2024 13:24
Copy link

sonarcloud bot commented Aug 26, 2024

@teleivo
Copy link
Contributor Author

teleivo commented Aug 28, 2024

This is currently blocked because of #18270 (comment)

@teleivo teleivo closed this Aug 28, 2024
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.

1 participant