diff --git a/test/functional/services/remote/webdriver.ts b/test/functional/services/remote/webdriver.ts index c5613b9e27094a..867e78dfad8dcb 100644 --- a/test/functional/services/remote/webdriver.ts +++ b/test/functional/services/remote/webdriver.ts @@ -47,6 +47,7 @@ import { Browsers } from './browsers'; const throttleOption: string = process.env.TEST_THROTTLE_NETWORK as string; const headlessBrowser: string = process.env.TEST_BROWSER_HEADLESS as string; +const browserBinaryPath: string = process.env.TEST_BROWSER_BINARY_PATH as string; const remoteDebug: string = process.env.TEST_REMOTE_DEBUG as string; const certValidation: string = process.env.NODE_TLS_REJECT_UNAUTHORIZED as string; const SECOND = 1000; @@ -54,10 +55,8 @@ const MINUTE = 60 * SECOND; const NO_QUEUE_COMMANDS = ['getLog', 'getStatus', 'newSession', 'quit']; const downloadDir = resolve(REPO_ROOT, 'target/functional-tests/downloads'); const chromiumDownloadPrefs = { - prefs: { - 'download.default_directory': downloadDir, - 'download.prompt_for_download': false, - }, + 'download.default_directory': downloadDir, + 'download.prompt_for_download': false, }; /** @@ -93,8 +92,8 @@ async function attemptToCreateCommand( const buildDriverInstance = async () => { switch (browserType) { case 'chrome': { - const chromeCapabilities = Capabilities.chrome(); - const chromeOptions = [ + const chromeOptions = new chrome.Options(); + chromeOptions.addArguments( // Disables the sandbox for all process types that are normally sandboxed. 'no-sandbox', // Launches URL in new browser window. @@ -104,47 +103,55 @@ async function attemptToCreateCommand( // Use fake device for Media Stream to replace actual camera and microphone. 'use-fake-device-for-media-stream', // Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). Works with --use-fake-device-for-media-stream. - 'use-fake-ui-for-media-stream', - ]; + 'use-fake-ui-for-media-stream' + ); + if (process.platform === 'linux') { // The /dev/shm partition is too small in certain VM environments, causing // Chrome to fail or crash. Use this flag to work-around this issue // (a temporary directory will always be used to create anonymous shared memory files). - chromeOptions.push('disable-dev-shm-usage'); + chromeOptions.addArguments('disable-dev-shm-usage'); } + if (headlessBrowser === '1') { // Use --disable-gpu to avoid an error from a missing Mesa library, as per // See: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md - chromeOptions.push('headless', 'disable-gpu'); + chromeOptions.headless(); + chromeOptions.addArguments('disable-gpu'); } + if (certValidation === '0') { - chromeOptions.push('ignore-certificate-errors'); + chromeOptions.addArguments('ignore-certificate-errors'); } if (remoteDebug === '1') { // Visit chrome://inspect in chrome to remotely view/debug - chromeOptions.push('headless', 'disable-gpu', 'remote-debugging-port=9222'); + chromeOptions.headless(); + chromeOptions.addArguments('disable-gpu', 'remote-debugging-port=9222'); } - chromeCapabilities.set('goog:chromeOptions', { - w3c: true, - args: chromeOptions, - ...chromiumDownloadPrefs, - }); - chromeCapabilities.set('unexpectedAlertBehaviour', 'accept'); - chromeCapabilities.set('goog:loggingPrefs', { browser: 'ALL' }); - chromeCapabilities.setAcceptInsecureCerts(config.acceptInsecureCerts); + + if (browserBinaryPath) { + chromeOptions.setChromeBinaryPath(browserBinaryPath); + } + + const prefs = new logging.Preferences(); + prefs.setLevel(logging.Type.BROWSER, logging.Level.ALL); + chromeOptions.setUserPreferences(chromiumDownloadPrefs); + chromeOptions.setLoggingPrefs(prefs); + chromeOptions.set('unexpectedAlertBehaviour', 'accept'); + chromeOptions.setAcceptInsecureCerts(config.acceptInsecureCerts); let session; if (remoteSessionUrl) { session = await new Builder() .forBrowser(browserType) - .withCapabilities(chromeCapabilities) + .setChromeOptions(chromeOptions) .usingServer(remoteSessionUrl) .build(); } else { session = await new Builder() .forBrowser(browserType) - .withCapabilities(chromeCapabilities) + .setChromeOptions(chromeOptions) .setChromeService(new chrome.ServiceBuilder(chromeDriver.path).enableVerboseLogging()) .build(); } @@ -179,7 +186,7 @@ async function attemptToCreateCommand( edgeOptions.setBinaryPath(edgePaths.browserPath); const options = edgeOptions.get('ms:edgeOptions'); // overriding options to include preferences - Object.assign(options, chromiumDownloadPrefs); + Object.assign(options, { prefs: chromiumDownloadPrefs }); edgeOptions.set('ms:edgeOptions', options); const session = await new Builder() .forBrowser('MicrosoftEdge') diff --git a/x-pack/.telemetryrc.json b/x-pack/.telemetryrc.json index 4da44667e167fe..2c16491c1096bf 100644 --- a/x-pack/.telemetryrc.json +++ b/x-pack/.telemetryrc.json @@ -7,7 +7,6 @@ "plugins/apm/server/lib/apm_telemetry/index.ts", "plugins/canvas/server/collectors/collector.ts", "plugins/infra/server/usage/usage_collector.ts", - "plugins/ingest_manager/server/collectors/register.ts", "plugins/lens/server/usage/collectors.ts", "plugins/reporting/server/usage/reporting_usage_collector.ts", "plugins/maps/server/maps_telemetry/collectors/register.ts" diff --git a/x-pack/plugins/ingest_manager/server/collectors/register.ts b/x-pack/plugins/ingest_manager/server/collectors/register.ts index aad59ee74433cb..2be8eb22bc98ce 100644 --- a/x-pack/plugins/ingest_manager/server/collectors/register.ts +++ b/x-pack/plugins/ingest_manager/server/collectors/register.ts @@ -41,20 +41,20 @@ export function registerIngestManagerUsageCollector( packages: await getPackageUsage(soClient), }; }, - // schema: { // temporarily disabled because of type errors - // fleet_enabled: { type: 'boolean' }, - // agents: { - // total: { type: 'number' }, - // online: { type: 'number' }, - // error: { type: 'number' }, - // offline: { type: 'number' }, - // }, - // packages: { - // name: { type: 'keyword' }, - // version: { type: 'keyword' }, - // enabled: { type: boolean }, - // }, - // }, + schema: { + fleet_enabled: { type: 'boolean' }, + agents: { + total: { type: 'long' }, + online: { type: 'long' }, + error: { type: 'long' }, + offline: { type: 'long' }, + }, + packages: { + name: { type: 'keyword' }, + version: { type: 'keyword' }, + enabled: { type: 'boolean' }, + }, + }, }); // register usage collector diff --git a/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts b/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts index 78aa513d1a1dce..7093723806ea39 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/packages/get.ts @@ -69,7 +69,7 @@ export async function getLimitedPackages(options: { }); }) ); - return installedPackagesInfo.filter((pkgInfo) => isPackageLimited).map((pkgInfo) => pkgInfo.name); + return installedPackagesInfo.filter(isPackageLimited).map((pkgInfo) => pkgInfo.name); } export async function getPackageSavedObjects(savedObjectsClient: SavedObjectsClientContract) { diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 1ea16a2a9940c9..fbef75b9aa9cce 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -48,6 +48,42 @@ } } }, + "ingest_manager": { + "properties": { + "fleet_enabled": { + "type": "boolean" + }, + "agents": { + "properties": { + "total": { + "type": "long" + }, + "online": { + "type": "long" + }, + "error": { + "type": "long" + }, + "offline": { + "type": "long" + } + } + }, + "packages": { + "properties": { + "name": { + "type": "keyword" + }, + "version": { + "type": "keyword" + }, + "enabled": { + "type": "boolean" + } + } + } + } + }, "mlTelemetry": { "properties": { "file_data_visualizer": { diff --git a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts index 1ac1474e03700b..64e8aa16955a54 100644 --- a/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts +++ b/x-pack/test/ingest_manager_api_integration/apis/epm/list.ts @@ -34,5 +34,21 @@ export default function ({ getService }: FtrProviderContext) { warnAndSkipTest(this, log); } }); + + it('lists all limited packages from the registry', async function () { + if (server.enabled) { + const fetchLimitedPackageList = async () => { + const response = await supertest + .get('/api/ingest_manager/epm/packages/limited') + .set('kbn-xsrf', 'xxx') + .expect(200); + return response.body; + }; + const listResponse = await fetchLimitedPackageList(); + expect(listResponse.response).to.eql(['endpoint']); + } else { + warnAndSkipTest(this, log); + } + }); }); }