-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Telemetry for space awareness (#206493)
- Loading branch information
Showing
10 changed files
with
148 additions
and
14 deletions.
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
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
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
52 changes: 52 additions & 0 deletions
52
x-pack/test/fleet_api_integration/apis/space_awareness/telemetry.ts
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,52 @@ | ||
/* | ||
* 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 { SpaceTestApiClient } from './api_helper'; | ||
|
||
export default function (providerContext: FtrProviderContext) { | ||
const { getService } = providerContext; | ||
const supertest = getService('supertest'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const spaces = getService('spaces'); | ||
let TEST_SPACE_1: string; | ||
|
||
const apiClient = new SpaceTestApiClient(supertest); | ||
|
||
describe('space_telemetry', function () { | ||
before(async () => { | ||
TEST_SPACE_1 = spaces.getDefaultTestSpace(); | ||
await kibanaServer.savedObjects.cleanStandardList(); | ||
await kibanaServer.savedObjects.cleanStandardList({ | ||
space: TEST_SPACE_1, | ||
}); | ||
await spaces.createTestSpace(TEST_SPACE_1); | ||
await apiClient.postEnableSpaceAwareness(); | ||
await Promise.all([ | ||
apiClient.createAgentPolicy(), | ||
apiClient.createAgentPolicy(), | ||
apiClient.createAgentPolicy(TEST_SPACE_1), | ||
apiClient.createAgentPolicy(TEST_SPACE_1), | ||
apiClient.createAgentPolicy(TEST_SPACE_1), | ||
]); | ||
}); | ||
|
||
after(async () => { | ||
await kibanaServer.savedObjects.cleanStandardList(); | ||
await kibanaServer.savedObjects.cleanStandardList({ | ||
space: TEST_SPACE_1, | ||
}); | ||
}); | ||
|
||
it('return correct fleet usage', async () => { | ||
const res = await apiClient.getFleetUsage(); | ||
expect(res.usage.agent_policies.count).to.eql(5); | ||
expect(res.usage.agent_policies.count_with_non_default_space).to.eql(3); | ||
}); | ||
}); | ||
} |