Skip to content

Commit

Permalink
Added comment to code to explain why the arrays were sorted.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Dorlus committed Apr 30, 2020
1 parent ade2ece commit 8d32828
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ export default function({ getService }) {
'ilm', // data enricher
'isRollupIndex', // data enricher
];
// 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 Down Expand Up @@ -226,6 +228,8 @@ export default function({ getService }) {
'ilm', // data enricher
'isRollupIndex', // data enricher
];
// 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 Down

0 comments on commit 8d32828

Please sign in to comment.