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

Fix 7 order-dependent tests by adding a precondition #3498

Open
wants to merge 1 commit into
base: 2022.x
Choose a base branch
from

Conversation

lxb007981
Copy link

@lxb007981 lxb007981 commented Nov 19, 2023

Describe what this PR does / why we need it

This PR fix seven order-dependent tests by always adding a precondition.

Related test:
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverTest.testResolveProfileSpecific_givenNothing_thenReturnDefaultProfile
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverTest.testStartWithASlashIsOK
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverTest.testDataIdMustBeSpecified
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverTest.testInvalidDataId
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverTest.whenCustomizeSuffix_thenOverrideDefault
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverTest.testUrisInLocationShouldOverridesProperty
com.alibaba.cloud.nacos.configdata.NacosConfigDataLocationResolverTest.whenNoneInBootstrapContext_thenCreateNewConfigClientProperties

These seven tests are order-dependent flaky. they depend on the environment properties, but these properties are not properly set during the setup(). Some other tests set the properties individually (like testCommonPropertiesHasLowerPriority), which make the tests relying on these properties order-dependent.

Does this pull request fix one issue?

#3503

Describe how you did it

Properties are now set in the setup() method, which is executed before each test.

Describe how to verify it

Using a test order randomizer can trigger this order-dependent flakiness. Or one can directly run one of the flaky tests individually (instead of run the whole test class), and it will throw some error.

Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Nov 19, 2023

CLA assistant check
All committers have signed the CLA.

@yuluo-yx
Copy link
Collaborator

@lxb007981 Can you open issue to explain pr purpose?

@lxb007981
Copy link
Author

@lxb007981 Can you open issue to explain pr purpose?

Thank you for reviewing. This pr aims to fix the flakyness within this test class. The detailed issue is linked here. I'm willing to improve this pr is needed.

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.

3 participants