-
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
Merged
kpollich
merged 6 commits into
elastic:main
from
kpollich:fleet/fix-settings-fleet-server-hosts
Nov 10, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cfc50dd
Fix fleet_server_hosts value in fleet/settings API
kpollich 20b1dfd
Add tests + skip settings update tests
kpollich f3fac54
Merge branch 'main' into fleet/fix-settings-fleet-server-hosts
kibanamachine 6812620
Fix telemetry calculation
kpollich 5f27006
Fix telemetry test
kpollich 3e332f5
Fix telemetry calculation
kpollich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
]); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this is the right move to skip these tests - these are leftover from when we were using the
/settings
API to create new Fleet Server hosts. AFAIK this is no longer supported, as any Fleet Server Hosts within the Fleet settings saved object will be ignored. @nchaulet please correct me if I'm wrong here.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 comment
The 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
fleet_server_hosts
) part should be removed as part of the GA work (we should already mark them as deprecated in the open API spec and point to new fleet server hosts endpoints)