Skip to content

Commit

Permalink
[Obs AI Assistant] Update serverless tests to use cookie auth instead…
Browse files Browse the repository at this point in the history
… of API keys
  • Loading branch information
viduni94 committed Dec 6, 2024
1 parent 1b295fe commit f8b1bc7
Showing 1 changed file with 11 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,18 @@ export default function ApiTest({ getService }: FtrProviderContext) {
{ username: 'john', isPublic: false },
].map(async ({ username, isPublic }) => {
const visibility = isPublic ? 'Public' : 'Private';
const user = username === 'editor' ? 'slsEditor' : 'slsAdmin';

if (username === 'editor') {
await observabilityAIAssistantAPIClient
.slsEditor({
endpoint: 'PUT /internal/observability_ai_assistant/kb/user_instructions',
params: {
body: {
id: `${visibility.toLowerCase()}-doc-from-${username}`,
text: `${visibility} user instruction from "${username}"`,
public: isPublic,
},
},
})
.expect(200);
} else {
await observabilityAIAssistantAPIClient
.slsAdmin({
endpoint: 'PUT /internal/observability_ai_assistant/kb/user_instructions',
params: {
body: {
id: `${visibility.toLowerCase()}-doc-from-${username}`,
text: `${visibility} user instruction from "${username}"`,
public: isPublic,
},
},
})
.expect(200);
}
await observabilityAIAssistantAPIClient[user]({
endpoint: 'PUT /internal/observability_ai_assistant/kb/user_instructions',
params: {
body: {
id: `${visibility.toLowerCase()}-doc-from-${username}`,
text: `${visibility} user instruction from "${username}"`,
public: isPublic,
},
},
}).expect(200);
});

await Promise.all(promises);
Expand Down

0 comments on commit f8b1bc7

Please sign in to comment.