Skip to content

Commit 7ff6245

Browse files
[9.2] [Fleet] enable fleet agents status test (#241249) (#241278)
# Backport This will backport the following commits from `main` to `9.2`: - [[Fleet] enable fleet agents status test (#241249)](#241249) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Julia Bardi","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-30T12:44:54Z","message":"[Fleet] enable fleet agents status test (#241249)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/230292\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"2b4fa99f3b2732f8548d60c243b9449a5c591f12","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.3.0","v9.2.1"],"title":"[Fleet] enable fleet agents status test","number":241249,"url":"https://github.com/elastic/kibana/pull/241249","mergeCommit":{"message":"[Fleet] enable fleet agents status test (#241249)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/230292\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"2b4fa99f3b2732f8548d60c243b9449a5c591f12"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/241249","number":241249,"mergeCommit":{"message":"[Fleet] enable fleet agents status test (#241249)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/230292\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...","sha":"2b4fa99f3b2732f8548d60c243b9449a5c591f12"}},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Julia Bardi <[email protected]>
1 parent 0061fcb commit 7ff6245

File tree

1 file changed

+27
-46
lines changed
  • x-pack/solutions/security/test/fleet_api_integration/apis/agents

1 file changed

+27
-46
lines changed

x-pack/solutions/security/test/fleet_api_integration/apis/agents/status.ts

Lines changed: 27 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
import expect from '@kbn/expect';
99

10-
import { INGEST_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server';
11-
1210
import { AGENTS_INDEX } from '@kbn/fleet-plugin/common';
1311
import type { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
1412
import { 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

Comments
 (0)