Skip to content

Commit 1e17528

Browse files
committed
[Fleet] fix flaky test create agent policy (elastic#241251)
## Summary Closes elastic#213370 Fix flaky test by making the assert agnostic to the order in the package policies array. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... (cherry picked from commit b4b36d0)
1 parent 6c0bcd8 commit 1e17528

File tree

1 file changed

+5
-4
lines changed
  • x-pack/platform/test/fleet_api_integration/apis/agent_policy

1 file changed

+5
-4
lines changed

x-pack/platform/test/fleet_api_integration/apis/agent_policy/agent_policy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,8 +2271,7 @@ export default function (providerContext: FtrProviderContext) {
22712271
});
22722272
});
22732273

2274-
// FLAKY: https://github.com/elastic/kibana/issues/213370
2275-
describe.skip('POST /internal/fleet/agent_and_package_policies', () => {
2274+
describe('POST /internal/fleet/agent_and_package_policies', () => {
22762275
before(async () => {
22772276
await esArchiver.load('x-pack/platform/test/fixtures/es_archives/fleet/empty_fleet_server');
22782277
await kibanaServer.savedObjects.cleanStandardList();
@@ -2386,11 +2385,13 @@ export default function (providerContext: FtrProviderContext) {
23862385
.expect(200);
23872386

23882387
expect(createdPolicy.id).to.eql(requestBody.id);
2389-
expect(createdPolicy.package_policies[0].id).to.eql(requestBody.package_policies[0].id);
2388+
expect(createdPolicy.package_policies.map((policy: any) => policy.id).sort()).to.eql([
2389+
'test-package-policy-with-id',
2390+
'test-package-policy-with-id-2',
2391+
]);
23902392
expect(createdPolicy.package_policies[0].policy_ids).to.eql(
23912393
requestBody.package_policies[0].policy_ids
23922394
);
2393-
expect(createdPolicy.package_policies[1].id).to.eql(requestBody.package_policies[1].id);
23942395
expect(createdPolicy.package_policies[1].policy_ids).to.eql(
23952396
requestBody.package_policies[1].policy_ids
23962397
);

0 commit comments

Comments
 (0)