Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMT-248: re-enable flaky test #60882

Merged
merged 5 commits into from
Mar 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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