Skip to content

Commit 991b518

Browse files
authored
[Fleet] fix fleet_list_agent tests (#241289)
## Summary Closes #170690 ### 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) - [ ] ...
1 parent e826efb commit 991b518

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

x-pack/platform/test/fleet_api_integration/apis/agents/list.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ export default function ({ getService }: FtrProviderContext) {
1919
const mockAgentlessApiService = setupMockServer();
2020
let elasticAgentpkgVersion: string;
2121

22-
// FLAKY: https://github.com/elastic/kibana/issues/170690
23-
describe.skip('fleet_list_agent', () => {
22+
describe('fleet_list_agent', () => {
2423
let mockApiServer: http.Server;
2524

2625
before(async () => {
@@ -323,18 +322,6 @@ export default function ({ getService }: FtrProviderContext) {
323322
});
324323

325324
it('should not return agentless agents when showAgentless=false', async () => {
326-
// Set up default Fleet Server host, needed during agentless agent creation
327-
await supertest
328-
.post(`/api/fleet/fleet_server_hosts`)
329-
.set('kbn-xsrf', 'xxxx')
330-
.send({
331-
id: 'fleet-default-fleet-server-host',
332-
name: 'Default',
333-
is_default: true,
334-
host_urls: ['https://test.com:8080', 'https://test.com:8081'],
335-
})
336-
.expect(200);
337-
338325
// Create an agentless agent policy
339326
const { body: policyRes } = await supertest
340327
.post('/api/fleet/agent_policies')

x-pack/platform/test/fleet_api_integration/config.agent.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ import type { FtrConfigProviderContext } from '@kbn/test';
99

1010
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
1111
const baseFleetApiConfig = await readConfigFile(require.resolve('./config.base.ts'));
12+
const baseConfig = baseFleetApiConfig.getAll();
1213

1314
return {
14-
...baseFleetApiConfig.getAll(),
15+
...baseConfig,
1516
testFiles: [require.resolve('./apis/agents')],
1617
junit: {
1718
reportName: 'X-Pack Fleet Agent API Integration Tests',
1819
},
20+
kbnTestServer: {
21+
...baseConfig.kbnTestServer,
22+
serverArgs: [
23+
...baseConfig.kbnTestServer.serverArgs,
24+
// Add cloud configuration specifically for agent tests (needed for agentless functionality in ESS)
25+
`--xpack.cloud.id="ftr_fake_cloud_id:aGVsbG8uY29tOjQ0MyRFUzEyM2FiYyRrYm4xMjNhYmM="`,
26+
`--xpack.cloud.base_url="https://cloud.elastic.co"`,
27+
`--xpack.cloud.deployment_url="/deployments/deploymentId"`,
28+
],
29+
},
1930
};
2031
}

0 commit comments

Comments
 (0)