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 intermittent test failures in Scatter Gather tests #3840

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
import org.xml.sax.SAXException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand Down Expand Up @@ -252,8 +255,16 @@ private static boolean areJsonElementsEquivalent(JsonElement e1, JsonElement e2)
return false;
}

for (int i = 0; i < e1.getAsJsonArray().size(); i++) {
if (!areJsonElementsEquivalent(e1.getAsJsonArray().get(i), e2.getAsJsonArray().get(i))) {
List<JsonElement> list1 = new ArrayList<>();
e1.getAsJsonArray().forEach(list1::add);
List<JsonElement> list2 = new ArrayList<>();
e2.getAsJsonArray().forEach(list2::add);

list1.sort(Comparator.comparing(JsonElement::toString));
list2.sort(Comparator.comparing(JsonElement::toString));

for (int i = 0; i < list1.size(); i++) {
if (!areJsonElementsEquivalent(list1.get(i), list2.get(i))) {
return false;
}
}
Expand Down
Loading