diff --git a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts index e808c699b0cf..41232f73efa5 100644 --- a/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts +++ b/x-pack/test/fleet_api_integration/apis/agents/upgrade.ts @@ -601,7 +601,7 @@ export default function (providerContext: FtrProviderContext) { expect(typeof agent2data.body.item.upgrade_started_at).to.be('string'); }); - it('enrolled in a managed policy bulk upgrade force:true should respond with 200 and object of all success results. Should update the managed agent SOs', async () => { + it('enrolled in a managed policy bulk upgrade with force flag should respond with 200 and update the agent SOs', async () => { // update enrolled policy to managed await supertest.put(`/api/fleet/agent_policies/policy1`).set('kbn-xsrf', 'xxxx').send({ name: 'Test policy', @@ -628,7 +628,7 @@ export default function (providerContext: FtrProviderContext) { doc: { local_metadata: { elastic: { - agent: { upgradeable: true, version: '0.0.0' }, + agent: { upgradeable: true, version: semver.inc(kibanaVersion, 'patch') }, }, }, }, @@ -642,67 +642,13 @@ export default function (providerContext: FtrProviderContext) { version: kibanaVersion, agents: ['agent1', 'agent2'], force: true, - }) - .expect(200); + }); expect(body).to.eql({ agent1: { success: true }, agent2: { success: true }, }); - const [agent1data, agent2data] = await Promise.all([ - supertest.get(`/api/fleet/agents/agent1`), - supertest.get(`/api/fleet/agents/agent2`), - ]); - - expect(typeof agent1data.body.item.upgrade_started_at).to.be('string'); - expect(typeof agent2data.body.item.upgrade_started_at).to.be('string'); - }); - - it('enrolled in a managed policy bulk upgrade with force flag should respond with 200 and update the agent SOs', async () => { - // update enrolled policy to managed - await supertest.put(`/api/fleet/agent_policies/policy1`).set('kbn-xsrf', 'xxxx').send({ - name: 'Test policy', - namespace: 'default', - is_managed: true, - }); - - const kibanaVersion = await kibanaServer.version.get(); - await es.update({ - id: 'agent1', - refresh: 'wait_for', - index: AGENTS_INDEX, - body: { - doc: { - local_metadata: { elastic: { agent: { upgradeable: true, version: '0.0.0' } } }, - }, - }, - }); - await es.update({ - id: 'agent2', - refresh: 'wait_for', - index: AGENTS_INDEX, - body: { - doc: { - local_metadata: { - elastic: { - agent: { upgradeable: true, version: semver.inc(kibanaVersion, 'patch') }, - }, - }, - }, - }, - }); - // attempt to upgrade agent in managed policy - const { body } = await supertest - .post(`/api/fleet/agents/bulk_upgrade`) - .set('kbn-xsrf', 'xxx') - .send({ - version: kibanaVersion, - agents: ['agent1', 'agent2'], - force: true, - }); - expect(body).to.eql({}); - const [agent1data, agent2data] = await Promise.all([ supertest.get(`/api/fleet/agents/agent1`), supertest.get(`/api/fleet/agents/agent2`),