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 a flaky test testQueryParams #1285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dserfe
Copy link

@dserfe dserfe commented Sep 12, 2023

This PR is to fix a flaky test spark.RequestTest#testQueryParams, we found it when using the latest version of spark:

  1. To reproduce test failures:
  • Run the following cmds:
 mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=spark.RequestTest#testQueryParams -DnondexRuns=10
  • And then we'll get the following failures:
RequestTest.testQueryParams:479 Should return the query parameter names: arrays first differed at element [0]; expected:<[items]> but was:<[sort]>
  1. Why it fails:
    Line 471 Map<String, String[]> params = new HashMap<>(); ofsrc/test/java/spark/RequestTest.java defines a HashMap, which makes no guarantee about the iteration order. The specification about HashMap says that "This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time".
  2. Fix it:
    By changing HashMap into LinkedHashMap.

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