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

Fixes #2012 order dependent tests in CorrelationTest #2013

Conversation

SaaiVenkat
Copy link
Contributor

Issue

  • In com.networknt.correlation.CorrelationHandlerTest, the unit test testGetWithoutTidNoAutogen() can trigger java.lang.AssertionError when being run before the unit test testGetWithoutTid() in the same class because it pollutes state shared among tests.
  • It may be good to clean this state pollution so that some other tests do not fail in the future due to the shared state polluted by this test.

Fixes #2012

Solution

  • Resetting the CorrelationHandler.config to default value after the test testGetWithoutTidNoAutogen is run using CorrelationHandler.config.setAutogenCorrelationID(true);

Fixed order dependent tests in CorrelationHandlerTest by reloading CorrelationConfig
@SaaiVenkat SaaiVenkat changed the title Fix order dependent tests in CorrelationTest Fixes #2012 order dependent tests in CorrelationTest Nov 26, 2023
@stevehu stevehu merged commit b8db33e into networknt:master Nov 27, 2023
@stevehu
Copy link
Contributor

stevehu commented Nov 27, 2023

@SaaiVenkat It makes sense. Thanks a lot for your help.

younggwon1 pushed a commit to younggwon1/light-4j that referenced this pull request Feb 10, 2024
Fixed order dependent tests in CorrelationHandlerTest by reloading CorrelationConfig
@SaaiVenkat SaaiVenkat deleted the fix-order-dependent-test-in-correlation-test branch October 1, 2024 19:24
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.

Unit test testGetWithoutTid in CorrelationHandlerTest is order dependent
2 participants