mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* Backport #36986 to 6.8 * Undo changes that aren't supposed to be here
This commit is contained in:
parent
5f790a10dc
commit
866ad9bdfd
2 changed files with 15 additions and 4 deletions
|
@ -70,14 +70,13 @@ export function registerStatsApi(kbnServer, server, config) {
|
|||
const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('admin');
|
||||
const callCluster = (...args) => callWithRequest(req, ...args);
|
||||
|
||||
const usagePromise = shouldGetUsage ? getUsage(callCluster) : Promise.resolve();
|
||||
const usagePromise = shouldGetUsage ? getUsage(callCluster) : Promise.resolve({});
|
||||
try {
|
||||
const [ usage, clusterUuid ] = await Promise.all([
|
||||
usagePromise,
|
||||
getClusterUuid(callCluster),
|
||||
]);
|
||||
|
||||
|
||||
let modifiedUsage = usage;
|
||||
if (isLegacy) {
|
||||
// In an effort to make telemetry more easily augmented, we need to ensure
|
||||
|
|
|
@ -120,13 +120,25 @@ export default function ({ getService }) {
|
|||
});
|
||||
|
||||
describe('exclude usage', () => {
|
||||
it('should exclude usage from the API response', () => {
|
||||
it('should include an empty usage object from the API response', () => {
|
||||
return supertest
|
||||
.get('/api/stats?extended&exclude_usage')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200)
|
||||
.then(({ body }) => {
|
||||
expect(body).to.not.have.property('usage');
|
||||
expect(body).to.have.property('usage');
|
||||
expect(body.usage).to.eql({});
|
||||
});
|
||||
});
|
||||
|
||||
it('should include an empty usage object from the API response if `legacy` is provided', () => {
|
||||
return supertest
|
||||
.get('/api/stats?extended&exclude_usage&legacy')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200)
|
||||
.then(({ body }) => {
|
||||
expect(body).to.have.property('usage');
|
||||
expect(body.usage).to.eql({});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue