diff --git a/x-pack/test/api_integration/apis/fleet/agents/acks.ts b/x-pack/test/api_integration/apis/fleet/agents/acks.ts index db925813b90c4..437a5b58710c1 100644 --- a/x-pack/test/api_integration/apis/fleet/agents/acks.ts +++ b/x-pack/test/api_integration/apis/fleet/agents/acks.ts @@ -15,11 +15,11 @@ export default function(providerContext: FtrProviderContext) { const esArchiver = getService('esArchiver'); const esClient = getService('es'); - const supertest = getSupertestWithoutAuth(providerContext); + const supertestWithoutAuth = getSupertestWithoutAuth(providerContext); + const supertest = getService('supertest'); let apiKey: { id: string; api_key: string }; - // FLAKY: https://github.com/elastic/kibana/issues/60471 - describe.skip('fleet_agents_acks', () => { + describe('fleet_agents_acks', () => { before(async () => { await esArchiver.loadIfNeeded('fleet/agents'); @@ -50,7 +50,7 @@ export default function(providerContext: FtrProviderContext) { }); it('should return a 401 if this a not a valid acks access', async () => { - await supertest + await supertestWithoutAuth .post(`/api/ingest_manager/fleet/agents/agent1/acks`) .set('kbn-xsrf', 'xx') .set('Authorization', 'ApiKey NOT_A_VALID_TOKEN') @@ -61,7 +61,7 @@ export default function(providerContext: FtrProviderContext) { }); it('should return a 200 if this a valid acks request', async () => { - const { body: apiResponse } = await supertest + const { body: apiResponse } = await supertestWithoutAuth .post(`/api/ingest_manager/fleet/agents/agent1/acks`) .set('kbn-xsrf', 'xx') .set( @@ -91,16 +91,15 @@ export default function(providerContext: FtrProviderContext) { ], }) .expect(200); + expect(apiResponse.action).to.be('acks'); expect(apiResponse.success).to.be(true); + const { body: eventResponse } = await supertest .get(`/api/ingest_manager/fleet/agents/agent1/events`) .set('kbn-xsrf', 'xx') - .set( - 'Authorization', - `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` - ) .expect(200); + const expectedEvents = eventResponse.list.filter( (item: Record) => item.action_id === '48cebde1-c906-4893-b89f-595d943b72a1' || @@ -122,7 +121,7 @@ export default function(providerContext: FtrProviderContext) { }); it('should return a 400 when request event list contains event for another agent id', async () => { - const { body: apiResponse } = await supertest + const { body: apiResponse } = await supertestWithoutAuth .post(`/api/ingest_manager/fleet/agents/agent1/acks`) .set('kbn-xsrf', 'xx') .set( @@ -149,7 +148,7 @@ export default function(providerContext: FtrProviderContext) { }); it('should return a 400 when request event list contains action that does not belong to agent current actions', async () => { - const { body: apiResponse } = await supertest + const { body: apiResponse } = await supertestWithoutAuth .post(`/api/ingest_manager/fleet/agents/agent1/acks`) .set('kbn-xsrf', 'xx') .set( @@ -183,7 +182,7 @@ export default function(providerContext: FtrProviderContext) { }); it('should return a 400 when request event list contains action types that are not allowed for acknowledgement', async () => { - const { body: apiResponse } = await supertest + const { body: apiResponse } = await supertestWithoutAuth .post(`/api/ingest_manager/fleet/agents/agent1/acks`) .set('kbn-xsrf', 'xx') .set(