Skip to content

Commit

Permalink
Merge branch 'main' into 161576
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelas authored Nov 22, 2024
2 parents 7f14641 + e48ad46 commit 3d9dd5b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
35 changes: 27 additions & 8 deletions x-pack/test/functional/page_objects/index_management_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,33 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext)
},

async expectIndexIsDeleted(indexName: string) {
const table = await find.byCssSelector('table');
const rows = await table.findAllByTestSubject('indexTableRow');
const indexNames: string[] = await Promise.all(
rows.map(async (row) => {
return await (await row.findByTestSubject('indexTableIndexNameLink')).getVisibleText();
})
);
expect(indexNames.includes(indexName)).to.be(false);
try {
const table = await find.byCssSelector('table');
const rows = await table.findAllByTestSubject('indexTableRow');

const indexNames = await Promise.all(
rows.map(async (row) => {
try {
return await (
await row.findByTestSubject('indexTableIndexNameLink')
).getVisibleText();
} catch (error) {
// If the current row is stale, it has already been removed
if (error.name === 'StaleElementReferenceError') return undefined;
throw error; // Rethrow unexpected errors
}
})
).then((names) => names.filter((name) => name !== undefined));

expect(indexNames.includes(indexName)).to.be(false);
} catch (error) {
if (error.name === 'StaleElementReferenceError') {
// If the table itself is stale, it means all rows have been removed
return; // Pass the test since the table is gone
} else {
throw error; // Rethrow unexpected errors
}
}
},
async manageIndex(indexName: string) {
const id = `checkboxSelectIndex-${indexName}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
},
];

// FLAKY: https://github.com/elastic/kibana/issues/197175
describe.skip('/internal/observability_ai_assistant/chat/complete', function () {
describe('/internal/observability_ai_assistant/chat/complete', function () {
// TODO: https://github.com/elastic/kibana/issues/192751
this.tags(['skipMKI']);
let proxy: LlmProxy;
Expand Down Expand Up @@ -186,7 +185,11 @@ export default function ApiTest({ getService }: FtrProviderContext) {

const parsedEvents = decodeEvents(receivedChunks.join(''));

expect(parsedEvents.map((event) => event.type)).to.eql([
expect(
parsedEvents
.map((event) => event.type)
.filter((eventType) => eventType !== StreamingChatResponseEventType.BufferFlush)
).to.eql([
StreamingChatResponseEventType.MessageAdd,
StreamingChatResponseEventType.MessageAdd,
StreamingChatResponseEventType.ChatCompletionChunk,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
const esDeleteAllIndices = getService('esDeleteAllIndices');
const testIndexName = `index-ftr-test-${Math.random()}`;
const es = getService('es');
const retry = getService('retry');

describe('Indices', function () {
this.tags(['skipSvlSearch']);
Expand Down Expand Up @@ -73,7 +74,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
it('can delete index', async () => {
await pageObjects.indexManagement.confirmDeleteModalIsVisible();
await pageObjects.indexManagement.expectIndexIsDeleted(testIndexName);
await retry.try(async () => {
await pageObjects.indexManagement.expectIndexIsDeleted(testIndexName);
});
});
});
});
Expand Down

0 comments on commit 3d9dd5b

Please sign in to comment.