diff --git a/x-pack/test/api_integration/apis/management/index_management/indices.js b/x-pack/test/api_integration/apis/management/index_management/indices.js index 9442beda3501d7..04121928087007 100644 --- a/x-pack/test/api_integration/apis/management/index_management/indices.js +++ b/x-pack/test/api_integration/apis/management/index_management/indices.js @@ -199,7 +199,11 @@ export default function({ getService }) { 'ilm', // data enricher 'isRollupIndex', // data enricher ]; - expect(Object.keys(body[0])).to.eql(expectedKeys); + // We need to sort the keys before comparing then, because race conditions + // can cause enrichers to register in non-deterministic order. + const sortedExpectedKeys = expectedKeys.sort(); + const sortedReceivedKeys = Object.keys(body[0]).sort(); + expect(sortedReceivedKeys).to.eql(sortedExpectedKeys); }); }); @@ -225,7 +229,11 @@ export default function({ getService }) { 'ilm', // data enricher 'isRollupIndex', // data enricher ]; - expect(Object.keys(body[0])).to.eql(expectedKeys); + // We need to sort the keys before comparing then, because race conditions + // can cause enrichers to register in non-deterministic order. + const sortedExpectedKeys = expectedKeys.sort(); + const sortedReceivedKeys = Object.keys(body[0]).sort(); + expect(sortedReceivedKeys).to.eql(sortedExpectedKeys); expect(body.length > 1).to.be(true); // to contrast it with the next test }); });