redpipe icon indicating copy to clipboard operation
redpipe copied to clipboard

Fix flaky test based on Nondex

Open SpiceOwlf opened this issue 3 years ago • 1 comments

Hi, I used Nondex(https://github.com/TestingResearchIllinois/NonDex) on the project and found [checkTemplateNegociationDefault] does not have a uniform behavior. So I made some changes to the test to make it pass all possible situations. Please let me know if you want to discuss this change more. Thanks.

SpiceOwlf avatar Oct 23 '21 04:10 SpiceOwlf

Updates: The root cause of the failure is that (1) the templates are read from thedisk using listFiles() in https://github.com/FroMage/redpipe/blob/0aff891d6befdf0dcc2bdbfda22262cdf82ac66f/redpipe-engine/src/main/java/net/redpipe/engine/template/AbstractTemplate.java#L88 and (2) the files are put in a HashMap of variants in https://github.com/FroMage/redpipe/blob/0aff891d6befdf0dcc2bdbfda22262cdf82ac66f/redpipe-engine/src/main/java/net/redpipe/engine/template/AbstractTemplate.java#L94 Neither listFiles() nor HashMap guarantee the order of the elements, so the order of the variants in nondeterministic. When the default variant is chosen as the first from the map it can end up being one of the two variants, while the assertion expects it to be only one.

SpiceOwlf avatar Dec 06 '21 22:12 SpiceOwlf