From 565251bca4ae95698be8deabda993097ac1a4021 Mon Sep 17 00:00:00 2001 From: criamico Date: Wed, 3 Nov 2021 12:08:29 +0100 Subject: [PATCH] Fix failing tests --- .../apis/package_policy/create.ts | 8 ++++---- .../apis/package_policy/update.ts | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts index 6b3401c48069a..6817289d389f3 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/create.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/create.ts @@ -68,7 +68,7 @@ export default function (providerContext: FtrProviderContext) { .post(`/api/fleet/package_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'filetest-1', + name: 'filetest', description: '', namespace: 'default', policy_id: hostedPolicy.id, @@ -85,7 +85,7 @@ export default function (providerContext: FtrProviderContext) { expect(responseWithoutForce.statusCode).to.be(400); expect(responseWithoutForce.message).to.contain( - 'Cannot add integrations to hosted agent policy' + 'Cannot update integrations of hosted agent policy' ); // try same request with `force: true` @@ -122,7 +122,7 @@ export default function (providerContext: FtrProviderContext) { .post(`/api/fleet/package_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'filetest-1', + name: 'filetest-2', description: '', namespace: 'default', policy_id: agentPolicyId, @@ -282,7 +282,7 @@ export default function (providerContext: FtrProviderContext) { .post(`/api/fleet/agent_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'Test policy', + name: 'Test policy 2', namespace: 'default', }); const otherAgentPolicyId = agentPolicyResponse.item.id; diff --git a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts index ceb9ad8c836e1..7d62ea3bf7ec3 100644 --- a/x-pack/test/fleet_api_integration/apis/package_policy/update.ts +++ b/x-pack/test/fleet_api_integration/apis/package_policy/update.ts @@ -158,7 +158,7 @@ export default function (providerContext: FtrProviderContext) { }); }); - it('should return a 500 if there is another package policy with the same name', async function () { + it('should return a 400 if there is another package policy with the same name', async function () { await supertest .put(`/api/fleet/package_policies/${packagePolicyId2}`) .set('kbn-xsrf', 'xxxx') @@ -176,15 +176,15 @@ export default function (providerContext: FtrProviderContext) { version: '0.1.0', }, }) - .expect(500); + .expect(400); }); - it('should return a 500 if there is another package policy with the same name on a different policy', async function () { + it('should return a 400 if there is another package policy with the same name on a different policy', async function () { const { body: agentPolicyResponse } = await supertest .post(`/api/fleet/agent_policies`) .set('kbn-xsrf', 'xxxx') .send({ - name: 'Test policy', + name: 'Test policy 2', namespace: 'default', }); const otherAgentPolicyId = agentPolicyResponse.item.id; @@ -206,7 +206,7 @@ export default function (providerContext: FtrProviderContext) { version: '0.1.0', }, }) - .expect(500); + .expect(400); }); it('should work with frozen input vars', async function () {