-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Index Management] Filter system indices from cat API request #104155
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,12 +177,19 @@ export default function ({ getService }) { | |
}); | ||
}); | ||
|
||
// FLAKY: https://github.com/elastic/kibana/issues/64473 | ||
describe.skip('list', function () { | ||
describe('list', function () { | ||
this.tags(['skipCloud']); | ||
|
||
it('should list all the indices with the expected properties and data enrichers', async function () { | ||
const { body } = await list().expect(200); | ||
// Create an index that we can assert against | ||
await createIndex('test_index'); | ||
|
||
// Verify indices request | ||
const { body: indices } = await list().expect(200); | ||
|
||
// Find the "test_index" created to verify expected keys | ||
const indexCreated = indices.find((index) => index.name === 'test_index'); | ||
|
||
const expectedKeys = [ | ||
'health', | ||
'hidden', | ||
|
@@ -203,7 +210,8 @@ export default function ({ getService }) { | |
// 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(); | ||
const sortedReceivedKeys = Object.keys(indexCreated).sort(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm hoping that by asserting against a specific index this test will be more stable. It's possible for an index to also have a |
||
|
||
expect(sortedReceivedKeys).to.eql(sortedExpectedKeys); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a bit silly, but I'm wondering if performance could be a concern. We know users might have hundreds of thousands (maybe millions) of indices. In this case we are doubling memory consumption by creating the
filteredCatHits
variable, and also doubling the number of iterations by adding anotherfilter
loop. There's a good chance that testing could reveal this to be a non-issue. But we could also just make the code immune to these concerns by sticking with a single loop and doing ourundefined
check within the loop:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 great point. Thanks for fixing!