Skip to content

Commit 1891f99

Browse files
Fix failing test: assert only values and not their specific order (#127270)
1 parent ee2d2f3 commit 1891f99

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

x-pack/plugin/security/qa/multi-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/CrossClusterEsqlRCS1EnrichUnavailableRemotesIT.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import static org.hamcrest.Matchers.endsWith;
3131
import static org.hamcrest.Matchers.equalTo;
3232
import static org.hamcrest.Matchers.greaterThan;
33+
import static org.hamcrest.Matchers.hasItemInArray;
3334
import static org.hamcrest.Matchers.is;
3435
import static org.hamcrest.Matchers.oneOf;
3536

@@ -74,6 +75,9 @@ public class CrossClusterEsqlRCS1EnrichUnavailableRemotesIT extends AbstractRemo
7475

7576
private final String[] modes = { "_coordinator", "_remote" };
7677

78+
// These are the IDs used in the test data in setSourceData().
79+
private final Integer[] employeeIDs = { 1, 2, 3, 4, 5, 6 };
80+
7781
@Before
7882
public void setupPreRequisites() throws IOException {
7983
setupRolesAndPrivileges();
@@ -121,7 +125,7 @@ private void esqlEnrichWithRandomSkipUnavailable() throws Exception {
121125
// Email
122126
assertThat(info.apply("email was: " + value.get(0)), (String) value.get(0), endsWith("@corp.co"));
123127
// ID
124-
assertThat(info.apply("id"), value.get(1), is(i + 1));
128+
assertThat(info.apply("id"), employeeIDs, hasItemInArray((int) value.get(1)));
125129
}
126130

127131
assertThat(info.apply("total clusters"), (int) clusters.get("total"), is(2));
@@ -170,7 +174,7 @@ private void esqlEnrichWithSkipUnavailableTrue() throws Exception {
170174
// Email
171175
assertThat(info.apply("email was: " + value.get(0)), (String) value.get(0), endsWith("@corp.co"));
172176
// ID
173-
assertThat(info.apply("id"), value.get(1), is(i + 1));
177+
assertThat(info.apply("id"), employeeIDs, hasItemInArray((int) value.get(1)));
174178
}
175179

176180
assertThat(info.apply("total clusters"), (int) clusters.get("total"), is(2));

0 commit comments

Comments
 (0)