[Obs AI Assistant] Fix connector test in MKI (#211235)

Closes https://github.com/elastic/kibana/issues/211175

## Problem

The connectors test is failing Serverless because we now have a
pre-configured inference connector

## Solution

Filter out the pre-configured inference connector in tests

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Viduni Wickramarachchi 2025-02-14 11:35:42 -05:00 committed by GitHub
parent 0a50f776eb
commit c1d0559738
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,9 +11,6 @@ import type { DeploymentAgnosticFtrProviderContext } from '../../../../ftr_provi
export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderContext) {
const observabilityAIAssistantAPIClient = getService('observabilityAIAssistantApi');
describe('List connectors', function () {
// Fails on MKI: https://github.com/elastic/kibana/issues/211175
this.tags(['failsOnMKI']);
before(async () => {
await observabilityAIAssistantAPIClient.deleteAllActionConnectors();
});
@ -35,7 +32,10 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
endpoint: 'GET /internal/observability_ai_assistant/connectors',
});
expect(res.body.length).to.be(0);
const connectorsExcludingPreconfiguredInference = res.body.filter(
(c) => c.actionTypeId !== '.inference'
);
expect(connectorsExcludingPreconfiguredInference.length).to.be(0);
});
it("returns the gen ai connector if it's been created", async () => {
@ -47,7 +47,10 @@ export default function ApiTest({ getService }: DeploymentAgnosticFtrProviderCon
endpoint: 'GET /internal/observability_ai_assistant/connectors',
});
expect(res.body.length).to.be(1);
const connectorsExcludingPreconfiguredInference = res.body.filter(
(c) => c.actionTypeId !== '.inference'
);
expect(connectorsExcludingPreconfiguredInference.length).to.be(1);
await observabilityAIAssistantAPIClient.deleteActionConnector({ actionId: connectorId });
});