Skip to content

Commit

Permalink
[Fleet] Always create agent policy as active (#97874) (#97918)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
nchaulet and kibanamachine authored Apr 22, 2021
1 parent 43ad82b commit e5b8452
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/server/services/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class AgentPolicyService {
SAVED_OBJECT_TYPE,
{
...agentPolicy,
status: 'active',
is_managed: agentPolicy.is_managed ?? false,
revision: 1,
updated_at: new Date().toISOString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function ({ getService }: FtrProviderContext) {

const { body } = await supertest.get(`/api/fleet/agent_policies/${createdPolicy.id}`);
expect(body.item.is_managed).to.equal(false);
expect(body.item.status).to.be('active');
});

it('sets given is_managed value', async () => {
Expand Down Expand Up @@ -140,6 +141,7 @@ export default function ({ getService }: FtrProviderContext) {

expect(newPolicy).to.eql({
name: 'Copied policy',
status: 'active',
description: 'Test',
is_managed: false,
namespace: 'default',
Expand Down Expand Up @@ -242,6 +244,7 @@ export default function ({ getService }: FtrProviderContext) {
const { id, updated_at, ...newPolicy } = updatedPolicy;

expect(newPolicy).to.eql({
status: 'active',
name: 'Updated name',
description: 'Updated description',
namespace: 'default',
Expand Down

0 comments on commit e5b8452

Please sign in to comment.