Skip to content

Fix a number of flaky tests #1

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

mohasarc
Copy link
Owner

@mohasarc mohasarc commented Apr 13, 2021

Based on your comment and the follow-up comment to change src/main, I'm opening this PR to address some tests by changing src/main. If you prefer to address this differently, please let me know so I can revise the PR.

According to the test results obtained using the NonDex tool, I have confirmed several flaky tests; these tests can pass or fail non-deterministically. The main reason for this flakiness is the order of the fields returned by the getDeclatedFields() method. This method has been used internally by Jackson library's ObjectMapper; therefore, the default output of ObjectMapper is not deterministic (documentation).

To solve this, I have configured ObjectMapper to return the fields in alphabetical order.

Finally, I have changed some of the tests into an alphabetical order to fit the changes to the main code. here is a list of all the flaky tests that were fixed:

  • cz.habarta.typescript.generator.EnumTest.testObjectEnum
  • cz.habarta.typescript.generator.GenericsTest.testAdvancedGenerics
  • cz.habarta.typescript.generator.JsonUnwrappedTest.test
  • cz.habarta.typescript.generator.JsonUnwrappedTest.testPrivateField
  • cz.habarta.typescript.generator.ClassesTest.testUnsortedConstructor
  • cz.habarta.typescript.generator.Jackson2ParserTest.test
  • cz.habarta.typescript.generator.OptionalTest.test
  • cz.habarta.typescript.generator.OptionalTest.testDeclarationNullableAndUndefinableType
  • cz.habarta.typescript.generator.OptionalTest.testDeclarationNullableType
  • cz.habarta.typescript.generator.OptionalTest.testDeclarationQuestionMark
  • cz.habarta.typescript.generator.OptionalTest.testDeclarationQuestionMarkAndNullableType
  • cz.habarta.typescript.generator.OptionalTest.testDeclarationUndefinableType
  • cz.habarta.typescript.generator.TaggedUnionsTest.testTaggedUnions
  • cz.habarta.typescript.generator.TaggedUnionsTest.testTaggedUnionsDisabled
  • cz.habarta.typescript.generator.TaggedUnionsTest.testTaggedUnionsWithExistingProperty
  • cz.habarta.typescript.generator.TaggedUnionsTest.testTaggedUnionsWithInterfaces
  • cz.habarta.typescript.generator.JavadocTest.testJavadoc
  • cz.habarta.typescript.generator.TaggedUnionsTest.testIntermediateUnions
  • cz.habarta.typescript.generator.JaxrsApplicationTest.testEnumQueryParam

@mohasarc mohasarc changed the title Fix flaky property order Fix a number of flaky tests Jun 21, 2021
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