[Fleet] Avoid to create cloud fleet server hosts in serverless (#163185)

This commit is contained in:
Nicolas Chaulet 2023-08-07 10:03:37 -04:00 committed by GitHub
parent 4d8bf22d79
commit 9377ae708e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -112,6 +112,23 @@ describe('getCloudFleetServersHosts', () => {
expect(getCloudFleetServersHosts()).toBeUndefined();
});
it('should return fleet server hosts if cloud is correctly setup in serverless', () => {
mockedAppContextService.getCloud.mockReturnValue({
cloudId:
'dXMtZWFzdC0xLmF3cy5mb3VuZC5pbyRjZWM2ZjI2MWE3NGJmMjRjZTMzYmI4ODExYjg0Mjk0ZiRjNmMyY2E2ZDA0MjI0OWFmMGNjN2Q3YTllOTYyNTc0Mw==',
isCloudEnabled: true,
deploymentId: 'deployment-id-1',
cloudHost: 'us-east-1.aws.found.io',
apm: {},
isServerlessEnabled: true,
serverless: {
projectId: undefined,
},
});
expect(getCloudFleetServersHosts()).toBeUndefined();
});
it('should return fleet server hosts if cloud is correctly setup with default port == 443', () => {
mockedAppContextService.getCloud.mockReturnValue({
cloudId:

View file

@ -27,7 +27,12 @@ import { isDifferent } from './utils';
export function getCloudFleetServersHosts() {
const cloudSetup = appContextService.getCloud();
if (cloudSetup && cloudSetup.isCloudEnabled && cloudSetup.cloudHost) {
if (
cloudSetup &&
!cloudSetup.isServerlessEnabled &&
cloudSetup.isCloudEnabled &&
cloudSetup.cloudHost
) {
// Fleet Server url are formed like this `https://<deploymentId>.fleet.<host>
return [
`https://${cloudSetup.deploymentId}.fleet.${cloudSetup.cloudHost}${