diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/ai_assistant/tests/knowledge_base/knowledge_base_user_instructions.spec.ts b/x-pack/test_serverless/api_integration/test_suites/observability/ai_assistant/tests/knowledge_base/knowledge_base_user_instructions.spec.ts index e2e134f613a14..6d147b7c2d372 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/ai_assistant/tests/knowledge_base/knowledge_base_user_instructions.spec.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/ai_assistant/tests/knowledge_base/knowledge_base_user_instructions.spec.ts @@ -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);