77
88import expect from '@kbn/expect' ;
99
10- import { INGEST_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server' ;
11-
1210import { AGENTS_INDEX } from '@kbn/fleet-plugin/common' ;
1311import type { FtrProviderContext } from '../../../api_integration/ftr_provider_context' ;
1412import { testUsers } from '../test_users' ;
@@ -19,31 +17,22 @@ export default function ({ getService }: FtrProviderContext) {
1917 const supertest = getService ( 'supertest' ) ;
2018 const superTestWithoutAuth = getService ( 'supertestWithoutAuth' ) ;
2119
22- // Failing: See https://github.com/elastic/kibana/issues/230292
23- describe . skip ( 'fleet_agents_status' , ( ) => {
20+ describe ( 'fleet_agents_status' , ( ) => {
2421 before ( async ( ) => {
2522 await esArchiver . loadIfNeeded ( 'x-pack/platform/test/fixtures/es_archives/fleet/agents' ) ;
26- await es . create ( {
27- id : 'fleet-agent-policies:policy-inactivity-timeout' ,
28- index : INGEST_SAVED_OBJECT_INDEX ,
29- refresh : 'wait_for' ,
30- document : {
31- type : 'fleet-agent-policies' ,
32- 'fleet-agent-policies' : {
33- name : 'Test policy' ,
34- namespace : 'default' ,
35- description : 'Policy with inactivity timeout' ,
36- status : 'active' ,
37- is_default : true ,
38- monitoring_enabled : [ 'logs' , 'metrics' ] ,
39- revision : 2 ,
40- updated_at : '2020-05-07T19:34:42.533Z' ,
41- updated_by : 'system' ,
42- inactivity_timeout : 60 ,
43- } ,
44- typeMigrationVersion : '7.10.0' ,
45- } ,
46- } ) ;
23+ await supertest
24+ . post ( `/api/fleet/agent_policies` )
25+ . set ( 'kbn-xsrf' , 'xxxx' )
26+ . send ( {
27+ id : 'policy-inactivity-timeout' ,
28+ name : 'Test policy inactivity timeout' ,
29+ namespace : 'default' ,
30+ description : 'Policy with inactivity timeout' ,
31+ is_default : true ,
32+ monitoring_enabled : [ 'logs' , 'metrics' ] ,
33+ inactivity_timeout : 60 ,
34+ } )
35+ . expect ( 200 ) ;
4736 // 2 agents online
4837 await es . update ( {
4938 id : 'agent1' ,
@@ -292,27 +281,19 @@ export default function ({ getService }: FtrProviderContext) {
292281
293282 await Promise . all (
294283 policiesToAdd . map ( ( policyId ) =>
295- es . create ( {
296- id : 'fleet-agent-policies:' + policyId ,
297- index : INGEST_SAVED_OBJECT_INDEX ,
298- refresh : 'wait_for' ,
299- document : {
300- type : 'fleet-agent-policies' ,
301- 'fleet-agent-policies' : {
302- name : policyId ,
303- namespace : 'default' ,
304- description : 'Policy with inactivity timeout' ,
305- status : 'active' ,
306- is_default : true ,
307- monitoring_enabled : [ 'logs' , 'metrics' ] ,
308- revision : 2 ,
309- updated_at : '2020-05-07T19:34:42.533Z' ,
310- updated_by : 'system' ,
311- inactivity_timeout : 60 ,
312- } ,
313- typeMigrationVersion : '7.10.0' ,
314- } ,
315- } )
284+ supertest
285+ . post ( `/api/fleet/agent_policies` )
286+ . set ( 'kbn-xsrf' , 'xxxx' )
287+ . send ( {
288+ id : 'fleet-agent-policies:' + policyId ,
289+ name : policyId ,
290+ namespace : 'default' ,
291+ description : 'Policy with inactivity timeout' ,
292+ is_default : true ,
293+ monitoring_enabled : [ 'logs' , 'metrics' ] ,
294+ inactivity_timeout : 60 ,
295+ } )
296+ . expect ( 200 )
316297 )
317298 ) ;
318299 const { body : apiResponse } = await supertest . get ( `/api/fleet/agent_status` ) . expect ( 200 ) ;
0 commit comments