Repository navigation
test: pin the default locale in SpringDocApp238Test - #3380
Open
sharanggupta wants to merge 1 commit into
Open
sharanggupta wants to merge 1 commit into
sharanggupta wants to merge 1 commit into
Conversation
SpringDocApp238Test resolves the @Info title and the tag names through a ResourceBundleMessageSource for en-US, fr-CA and zh-CN and compares the output with fixtures written for the base messages.properties bundle. ResourceBundleMessageSource falls back to the JVM default locale before the base bundle, so on a machine whose default locale is en_GB the en-US request (and the zh-CN one, which the allowed-locales setting maps to en-US) picks up messages_en_GB.properties and the test fails with "This is a test message[EN_GB]". Pin the default locale to en-US for the duration of the class and restore it afterwards, as SpringDocApp14Test already does, so the fixtures are deterministic regardless of the host locale. Fixes springdoc#3379
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3379
SpringDocApp238Test(v30 and v31) fails on hosts whose default locale isen_GB:ResourceBundleMessageSourcefalls back to the JVM default locale before the base bundle, so theen-USandzh-CN(mapped toen-US) lookups pick upmessages_en_GB.propertiesand the fixtures no longer match.This change pins the default locale to
en-USfor the duration of the test class and restores the previous value afterwards, mirroringSpringDocApp14Test. No production code or fixtures change.Verified:
mvn -pl springdoc-openapi-starter-webmvc-api test -Dtest=SpringDocApp238Test -DargLine="-Duser.language=en -Duser.country=GB"fails before, passes after-Duser.country=USpassesmvn -pl springdoc-openapi-starter-webmvc-api test -DargLine="-Duser.language=en -Duser.country=GB": 653 tests, 0 failures