-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fleet] Fix fleet_server_hosts
value in fleet/settings API
#144898
Changes from 4 commits
cfc50dd
20b1dfd
f3fac54
6812620
5f27006
3e332f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context'; | ||
import { skipIfNoDockerRegistry } from '../../helpers'; | ||
import { setupFleetAndAgents } from '../agents/services'; | ||
|
||
export default function (providerContext: FtrProviderContext) { | ||
const { getService } = providerContext; | ||
const supertest = getService('supertest'); | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
|
||
describe('Settings - get', async function () { | ||
skipIfNoDockerRegistry(providerContext); | ||
before(async () => { | ||
await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server'); | ||
}); | ||
setupFleetAndAgents(providerContext); | ||
|
||
after(async () => { | ||
await kibanaServer.savedObjects.cleanStandardList(); | ||
await esArchiver.unload('x-pack/test/functional/es_archives/fleet/empty_fleet_server'); | ||
}); | ||
|
||
it('should respond with fleet_server_hosts', async function () { | ||
// Create a fleet server host | ||
await supertest | ||
.post(`/api/fleet/fleet_server_hosts`) | ||
.set('kbn-xsrf', 'xxxx') | ||
.send({ | ||
id: 'test-default-123', | ||
name: 'Default', | ||
is_default: true, | ||
host_urls: ['https://test.com:8080', 'https://test.com:8081'], | ||
}) | ||
.expect(200); | ||
|
||
// Assert that the hosts appear in the setting response | ||
const response = await supertest | ||
.get(`/api/fleet/settings`) | ||
.set('kbn-xsrf', 'xxxx') | ||
.expect(200); | ||
|
||
expect(response.body.item.fleet_server_hosts).to.eql([ | ||
'https://test.com:8080', | ||
'https://test.com:8081', | ||
]); | ||
}); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ export default function (providerContext: FtrProviderContext) { | |
const esClient = getService('es'); | ||
const esArchiver = getService('esArchiver'); | ||
|
||
describe('Settings - update', async function () { | ||
// Skipped as the Fleet Server hosts settings values are no longer used as of https://github.com/elastic/kibana/issues/137785 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the right move to skip these tests - these are leftover from when we were using the We'll probably want to remove this API altogether as part of the GA work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we probably want to remove these tests, and this API (at least the |
||
describe.skip('Settings - update', async function () { | ||
skipIfNoDockerRegistry(providerContext); | ||
before(async () => { | ||
await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I update this telemetry collector to use the new Fleet Server Hosts model for its calculation instead of the settings SO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍