[Fleet] Always create agent policy as active (#97874)

This commit is contained in:
Nicolas Chaulet 2021-04-21 17:13:48 -04:00 committed by GitHub
parent 78c0c6eb83
commit ee7ba71b43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -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(),

View file

@ -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 () => {
@ -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',
@ -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',