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 315ca276c393ffb..ceb9ad8c836e1d5 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 @@ -179,6 +179,36 @@ export default function (providerContext: FtrProviderContext) { .expect(500); }); + it('should return a 500 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', + namespace: 'default', + }); + const otherAgentPolicyId = agentPolicyResponse.item.id; + + await supertest + .put(`/api/fleet/package_policies/${packagePolicyId2}`) + .set('kbn-xsrf', 'xxxx') + .send({ + name: 'filetest-1', + description: '', + namespace: 'updated_namespace', + policy_id: otherAgentPolicyId, + enabled: true, + output_id: '', + inputs: [], + package: { + name: 'filetest', + title: 'For File Tests', + version: '0.1.0', + }, + }) + .expect(500); + }); + it('should work with frozen input vars', async function () { await supertest .put(`/api/fleet/package_policies/${packagePolicyId}`)