Skip to content

Commit

Permalink
[8.x] [Obs AI Assistant] Unskip user instructions test (#205656) (#20…
Browse files Browse the repository at this point in the history
…5897) (#206082)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Obs AI Assistant] Unskip user instructions test (#205656)
(#205897)](#205897)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Viduni
Wickramarachchi","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-09T15:01:15Z","message":"[Obs
AI Assistant] Unskip user instructions test (#205656)
(#205897)\n\nCloses
https://github.com/elastic/kibana/issues/205656\r\n\r\n##
Summary\r\n\r\n### Problem\r\nThere seems to be a race condition and
state contamination between tests\r\nin the KB user instructions
tests.\r\n\r\n### Solution\r\n- Clear knowledge base and conversations
after tests\r\n- Remove title interceptor --> we don't need title
interception for\r\nthese tests\r\n\r\n### Checklist\r\n\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"37d7a5efb760dc271a4fb26f1eeba0d66e037b07","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Obs
AI
Assistant","ci:project-deploy-observability","backport:version","v8.18.0"],"title":"[Obs
AI Assistant] Unskip user instructions test
(#205656)","number":205897,"url":"https://github.com/elastic/kibana/pull/205897","mergeCommit":{"message":"[Obs
AI Assistant] Unskip user instructions test (#205656)
(#205897)\n\nCloses
https://github.com/elastic/kibana/issues/205656\r\n\r\n##
Summary\r\n\r\n### Problem\r\nThere seems to be a race condition and
state contamination between tests\r\nin the KB user instructions
tests.\r\n\r\n### Solution\r\n- Clear knowledge base and conversations
after tests\r\n- Remove title interceptor --> we don't need title
interception for\r\nthese tests\r\n\r\n### Checklist\r\n\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"37d7a5efb760dc271a4fb26f1eeba0d66e037b07"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205897","number":205897,"mergeCommit":{"message":"[Obs
AI Assistant] Unskip user instructions test (#205656)
(#205897)\n\nCloses
https://github.com/elastic/kibana/issues/205656\r\n\r\n##
Summary\r\n\r\n### Problem\r\nThere seems to be a race condition and
state contamination between tests\r\nin the KB user instructions
tests.\r\n\r\n### Solution\r\n- Clear knowledge base and conversations
after tests\r\n- Remove title interceptor --> we don't need title
interception for\r\nthese tests\r\n\r\n### Checklist\r\n\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [x] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"37d7a5efb760dc271a4fb26f1eeba0d66e037b07"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Viduni Wickramarachchi <[email protected]>
  • Loading branch information
kibanamachine and viduni94 authored Jan 10, 2025
1 parent 69c421c commit 6cb4049
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,9 @@ export default function ApiTest({ getService }: FtrProviderContext) {
})
.expect(200);

const interceptPromises = [
proxy.interceptConversationTitle('LLM-generated title').completeAfterIntercept(),
proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept(),
];
const interceptPromise = proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept();

const messages: Message[] = [
{
Expand Down Expand Up @@ -283,8 +280,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
},
});

// wait for all interceptors to be settled
await Promise.all(interceptPromises);
await interceptPromise;

const conversation = res.body;
return conversation;
Expand All @@ -297,6 +293,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {

after(async () => {
proxy.close();
await clearKnowledgeBase(es);
await clearConversations(es);
await deleteActionConnector({ supertest, connectorId, log });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,9 @@ export default function ApiTest({ getService }: FtrProviderContext) {
})
.expect(200);

const interceptPromises = [
proxy.interceptConversationTitle('LLM-generated title').completeAfterIntercept(),
proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept(),
];
const interceptPromise = proxy
.interceptConversation({ name: 'conversation', response: 'I, the LLM, hear you!' })
.completeAfterIntercept();

const messages: Message[] = [
{
Expand Down Expand Up @@ -297,8 +294,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
},
});

// wait for all interceptors to be settled
await Promise.all(interceptPromises);
await interceptPromise;

const conversation = res.body;
return conversation;
Expand All @@ -317,6 +313,8 @@ export default function ApiTest({ getService }: FtrProviderContext) {

after(async () => {
proxy.close();
await clearKnowledgeBase(es);
await clearConversations(es);
await deleteActionConnector({
supertest: supertestWithoutAuth,
connectorId,
Expand Down

0 comments on commit 6cb4049

Please sign in to comment.