Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Jun 8, 2024
1 parent 28ce486 commit 4dcb675
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,6 @@ describe('Observability AI Assistant client', () => {
role: MessageRole.Assistant,
function_call: {
name: CONTEXT_FUNCTION_NAME,
arguments: JSON.stringify({}),
trigger: MessageRole.Assistant,
},
},
Expand Down Expand Up @@ -1456,7 +1455,6 @@ describe('Observability AI Assistant client', () => {
role: MessageRole.Assistant,
function_call: {
name: CONTEXT_FUNCTION_NAME,
arguments: JSON.stringify({}),
trigger: MessageRole.Assistant,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export default function ApiTest({ getService }: FtrProviderContext) {
role: MessageRole.Assistant,
function_call: {
name: 'context',
arguments: JSON.stringify({ queries: [], categories: [] }),
trigger: MessageRole.Assistant,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
format,
})
.set('kbn-xsrf', 'foo')
.set('elastic-api-version', '2023-10-31')
.send({
messages,
connectorId,
Expand All @@ -83,13 +84,20 @@ export default function ApiTest({ getService }: FtrProviderContext) {
if (err) {
return reject(err);
}
if (response.status !== 200) {
return reject(new Error(`${response.status}: ${JSON.stringify(response.body)}`));
}
return resolve(response);
});
});

const [conversationSimulator, titleSimulator] = await Promise.all([
conversationInterceptor.waitForIntercept(),
titleInterceptor.waitForIntercept(),
const [conversationSimulator, titleSimulator] = await Promise.race([
Promise.all([
conversationInterceptor.waitForIntercept(),
titleInterceptor.waitForIntercept(),
]),
// make sure any request failures (like 400s) are properly propagated
responsePromise.then(() => []),
]);

await titleSimulator.status(200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function ApiTest({ getService, getPageObjects }: FtrProviderConte
content: '',
function_call: {
name: 'context',
arguments: '{"queries":[],"categories":[]}',
arguments: '{}',
trigger: MessageRole.Assistant,
},
},
Expand Down Expand Up @@ -290,7 +290,6 @@ export default function ApiTest({ getService, getPageObjects }: FtrProviderConte

expect(pick(contextRequest.function_call, 'name', 'arguments')).to.eql({
name: 'context',
arguments: JSON.stringify({ queries: [], categories: [] }),
});

expect(contextResponse.name).to.eql('context');
Expand Down Expand Up @@ -354,7 +353,6 @@ export default function ApiTest({ getService, getPageObjects }: FtrProviderConte

expect(pick(contextRequest.function_call, 'name', 'arguments')).to.eql({
name: 'context',
arguments: JSON.stringify({ queries: [], categories: [] }),
});

expect(contextResponse.name).to.eql('context');
Expand Down

0 comments on commit 4dcb675

Please sign in to comment.