Skip to content

Commit

Permalink
Saved Object APIs - FTR - Fix flaky test in _find API (#160794)
Browse files Browse the repository at this point in the history
## Summary

Attempt to fix #156581

The best explanation I have is that the two retrieved visualisations are
not necessarily retrieved in the expected order.
Sorting the results should ensure the expected order.

Will use the flaky test runner to check the fix.
  • Loading branch information
gsoldevila authored Jun 29, 2023
1 parent bbccd9e commit 4e3f699
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/api_integration/apis/saved_objects/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

import { sortBy } from 'lodash';
import { MAIN_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server';
import expect from '@kbn/expect';
import { SavedObject } from '@kbn/core/server';
Expand Down Expand Up @@ -153,8 +154,7 @@ export default function ({ getService }: FtrProviderContext) {
}));
});

// FLAKY: https:/elastic/kibana/issues/156581
describe.skip('wildcard namespace', () => {
describe('wildcard namespace', () => {
it('should return 200 with individual responses from the all namespaces', async () =>
await supertest
.get(
Expand All @@ -165,7 +165,8 @@ export default function ({ getService }: FtrProviderContext) {
const knownDocuments = resp.body.saved_objects.filter((so: { namespaces: string[] }) =>
so.namespaces.some((ns) => [SPACE_ID, `${SPACE_ID}-foo`].includes(ns))
);
const [obj1, obj2] = knownDocuments.map(

const [obj1, obj2] = sortBy(knownDocuments, 'namespaces').map(
({ id, originId, namespaces }: SavedObject) => ({ id, originId, namespaces })
);

Expand Down

0 comments on commit 4e3f699

Please sign in to comment.