-
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.
- Loading branch information
Showing
14 changed files
with
115 additions
and
97 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
65 changes: 0 additions & 65 deletions
65
x-pack/test/api_integration/apis/telemetry/management_collection.ts
This file was deleted.
Oops, something went wrong.
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
9 changes: 9 additions & 0 deletions
9
x-pack/test/usage_collection/plugins/stack_management_usage_test/kibana.json
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,9 @@ | ||
{ | ||
"id": "StackManagementUsageTest", | ||
"version": "1.0.0", | ||
"kibanaVersion": "kibana", | ||
"configPath": ["xpack", "StackManagementUsageTest"], | ||
"requiredPlugins": [], | ||
"server": false, | ||
"ui": true | ||
} |
11 changes: 11 additions & 0 deletions
11
x-pack/test/usage_collection/plugins/stack_management_usage_test/public/index.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,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { StackManagementUsageTest } from './plugin'; | ||
|
||
export function plugin() { | ||
return new StackManagementUsageTest(); | ||
} |
17 changes: 17 additions & 0 deletions
17
x-pack/test/usage_collection/plugins/stack_management_usage_test/public/plugin.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,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Plugin, CoreSetup, CoreStart } from 'kibana/public'; | ||
import './types'; | ||
|
||
export class StackManagementUsageTest implements Plugin { | ||
public setup(core: CoreSetup) {} | ||
|
||
public start(core: CoreStart) { | ||
const allUiSettings = core.uiSettings.getAll(); | ||
window.__registeredUiSettings__ = allUiSettings; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
x-pack/test/usage_collection/plugins/stack_management_usage_test/public/types.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,14 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IUiSettingsClient } from 'src/core/public'; | ||
export {}; // Hack to declare this file as a module so TS allows us to extend the Global Window interface | ||
|
||
declare global { | ||
interface Window { | ||
__registeredUiSettings__: ReturnType<IUiSettingsClient['getAll']>; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
x-pack/test/usage_collection/plugins/stack_management_usage_test/tsconfig.json
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,12 @@ | ||
{ | ||
"extends": "../../../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "./target", | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"public/**/*.ts", | ||
"public/**/*.tsx", | ||
], | ||
"exclude": [] | ||
} |
45 changes: 45 additions & 0 deletions
45
x-pack/test/usage_collection/test_suites/stack_management_usage/index.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,45 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import _ from 'lodash'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
import { stackManagementSchema } from '../../../../../src/plugins/kibana_usage_collection/server/collectors/management/schema'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
describe('Stack Management', function () { | ||
this.tags('ciGroup1'); | ||
const { common } = getPageObjects(['common']); | ||
const browser = getService('browser'); | ||
|
||
let registeredSettings: Record<string, any>; | ||
|
||
before(async () => { | ||
await common.navigateToApp('home'); // Navigate to Home to make sure all the appIds are loaded | ||
registeredSettings = await browser.execute(() => window.__registeredUiSettings__); | ||
}); | ||
|
||
it('registers all UI Settings in the UsageStats interface', () => { | ||
const unreportedUISettings = Object.keys(registeredSettings) | ||
.filter((key) => key !== 'buildNum') | ||
.filter((key) => typeof _.get(stackManagementSchema, key) === 'undefined'); | ||
|
||
expect(unreportedUISettings).to.eql([]); | ||
}); | ||
|
||
it('registers all sensitive UI settings as boolean type', async () => { | ||
const sensitiveSettings = Object.entries(registeredSettings) | ||
.filter(([, config]) => config.sensitive) | ||
.map(([key]) => key); | ||
|
||
const nonBooleanSensitiveProps = sensitiveSettings | ||
.map((key) => ({ key, ..._.get(stackManagementSchema, key) })) | ||
.filter((keyDescriptor) => keyDescriptor.type !== 'boolean'); | ||
|
||
expect(nonBooleanSensitiveProps).to.eql([]); | ||
}); | ||
}); | ||
} |