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

Fixed indice assertion to loop through expected keys #64684

Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand All @@ -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
});
});
Expand Down