Skip to content

Commit

Permalink
[Ingest] EMT-248: renable test (#60882) (#61319)
Browse files Browse the repository at this point in the history
[Ingest]EMT-248: renable integration test, ran flaky test runner 100x2 and this test did not fail.
  • Loading branch information
nnamdifrankie authored Mar 25, 2020
1 parent 4acdf08 commit 19fe3c4
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions x-pack/test/api_integration/apis/fleet/agents/acks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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')
Expand All @@ -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(
Expand Down Expand Up @@ -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<string, string>) =>
item.action_id === '48cebde1-c906-4893-b89f-595d943b72a1' ||
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 19fe3c4

Please sign in to comment.