diff --git a/.buildkite/ftr_configs.yml b/.buildkite/ftr_configs.yml index 40be42461c4930..5340b4bf578cdf 100644 --- a/.buildkite/ftr_configs.yml +++ b/.buildkite/ftr_configs.yml @@ -162,10 +162,12 @@ enabled: - x-pack/test/functional/apps/maps/group2/config.ts - x-pack/test/functional/apps/maps/group3/config.ts - x-pack/test/functional/apps/maps/group4/config.ts + - x-pack/test/functional/apps/ml/anomaly_detection/config.ts + - x-pack/test/functional/apps/ml/data_frame_analytics/config.ts - x-pack/test/functional/apps/ml/data_visualizer/config.ts - - x-pack/test/functional/apps/ml/group1/config.ts - - x-pack/test/functional/apps/ml/group2/config.ts - - x-pack/test/functional/apps/ml/group3/config.ts + - x-pack/test/functional/apps/ml/permissions/config.ts + - x-pack/test/functional/apps/ml/short_tests/config.ts + - x-pack/test/functional/apps/ml/stack_management_jobs/config.ts - x-pack/test/functional/apps/monitoring/config.ts - x-pack/test/functional/apps/remote_clusters/config.ts - x-pack/test/functional/apps/reporting_management/config.ts diff --git a/packages/kbn-dev-utils/src/proc_runner/proc.ts b/packages/kbn-dev-utils/src/proc_runner/proc.ts index c622c46456abfe..323c1fb674317c 100644 --- a/packages/kbn-dev-utils/src/proc_runner/proc.ts +++ b/packages/kbn-dev-utils/src/proc_runner/proc.ts @@ -156,5 +156,8 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) { outcome$, outcomePromise, stop, + stopWasCalled() { + return stopCalled; + }, }; } diff --git a/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts b/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts index 857a4fcfd475d5..654a9d1080135a 100644 --- a/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts +++ b/packages/kbn-dev-utils/src/proc_runner/proc_runner.ts @@ -21,6 +21,7 @@ const noop = () => {}; interface RunOptions extends ProcOptions { wait: true | RegExp; waitTimeout?: number | false; + onEarlyExit?: (msg: string) => void; } /** @@ -47,16 +48,6 @@ export class ProcRunner { /** * Start a process, tracking it by `name` - * @param {String} name - * @param {Object} options - * @property {String} options.cmd executable to run - * @property {Array?} options.args arguments to provide the executable - * @property {String?} options.cwd current working directory for the process - * @property {RegExp|Boolean} options.wait Should start() wait for some time? Use - * `true` will wait until the proc exits, - * a `RegExp` will wait until that log line - * is found - * @return {Promise} */ async run(name: string, options: RunOptions) { const { @@ -66,6 +57,7 @@ export class ProcRunner { wait = false, waitTimeout = 15 * MINUTE, env = process.env, + onEarlyExit, } = options; const cmd = options.cmd === 'node' ? process.execPath : options.cmd; @@ -89,6 +81,25 @@ export class ProcRunner { stdin, }); + if (onEarlyExit) { + proc.outcomePromise + .then( + (code) => { + if (!proc.stopWasCalled()) { + onEarlyExit(`[${name}] exitted early with ${code}`); + } + }, + (error) => { + if (!proc.stopWasCalled()) { + onEarlyExit(`[${name}] exitted early: ${error.message}`); + } + } + ) + .catch((error) => { + throw new Error(`Error handling early exit: ${error.stack}`); + }); + } + try { if (wait instanceof RegExp) { // wait for process to log matching line diff --git a/packages/kbn-es/src/cluster.js b/packages/kbn-es/src/cluster.js index 50ca9fa91e0aab..eecaef06be453c 100644 --- a/packages/kbn-es/src/cluster.js +++ b/packages/kbn-es/src/cluster.js @@ -215,6 +215,25 @@ exports.Cluster = class Cluster { }), ]); }); + + if (options.onEarlyExit) { + this._outcome + .then( + () => { + if (!this._stopCalled) { + options.onEarlyExit(`ES exitted unexpectedly`); + } + }, + (error) => { + if (!this._stopCalled) { + options.onEarlyExit(`ES exitted unexpectedly: ${error.stack}`); + } + } + ) + .catch((error) => { + throw new Error(`failure handling early exit: ${error.stack}`); + }); + } } /** diff --git a/packages/kbn-es/src/cluster_exec_options.ts b/packages/kbn-es/src/cluster_exec_options.ts index 8ef3b23cd8c51d..da21aaf05b1396 100644 --- a/packages/kbn-es/src/cluster_exec_options.ts +++ b/packages/kbn-es/src/cluster_exec_options.ts @@ -15,4 +15,5 @@ export interface EsClusterExecOptions { password?: string; skipReadyCheck?: boolean; readyTimeout?: number; + onEarlyExit?: (msg: string) => void; } diff --git a/packages/kbn-test/src/es/test_es_cluster.ts b/packages/kbn-test/src/es/test_es_cluster.ts index 42dc19445c2931..c065cb01a4c364 100644 --- a/packages/kbn-test/src/es/test_es_cluster.ts +++ b/packages/kbn-test/src/es/test_es_cluster.ts @@ -146,6 +146,11 @@ export interface CreateTestEsClusterOptions { * defaults to the transport port from `packages/kbn-test/src/es/es_test_config.ts` */ transportPort?: number | string; + /** + * Report to the creator of the es-test-cluster that the es node has exitted before stop() was called, allowing + * this caller to react appropriately. If this is not passed then an uncatchable exception will be thrown + */ + onEarlyExit?: (msg: string) => void; } export function createTestEsCluster< @@ -165,6 +170,7 @@ export function createTestEsCluster< clusterName: customClusterName = 'es-test-cluster', ssl, transportPort, + onEarlyExit, } = options; const clusterName = `${CI_PARALLEL_PROCESS_PREFIX}${customClusterName}`; @@ -258,6 +264,7 @@ export function createTestEsCluster< // set it up after the last node is started. skipNativeRealmSetup: this.nodes.length > 1 && i < this.nodes.length - 1, skipReadyCheck: this.nodes.length > 1 && i < this.nodes.length - 1, + onEarlyExit, }); }); } diff --git a/packages/kbn-test/src/functional_test_runner/fake_mocha_types.ts b/packages/kbn-test/src/functional_test_runner/fake_mocha_types.ts index 96ebcd79c4e436..506b6f139f7364 100644 --- a/packages/kbn-test/src/functional_test_runner/fake_mocha_types.ts +++ b/packages/kbn-test/src/functional_test_runner/fake_mocha_types.ts @@ -37,6 +37,7 @@ export interface Test { export interface Runner extends EventEmitter { abort(): void; failures: any[]; + uncaught: (error: Error) => void; } export interface Mocha { diff --git a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts index 0ceba511f9b9bf..c9890dac711097 100644 --- a/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts +++ b/packages/kbn-test/src/functional_test_runner/functional_test_runner.ts @@ -43,7 +43,7 @@ export class FunctionalTestRunner { : new EsVersion(esVersion); } - async run() { + async run(abortSignal?: AbortSignal) { const testStats = await this.getTestStats(); return await this.runHarness(async (config, lifecycle, coreProviders) => { @@ -106,10 +106,19 @@ export class FunctionalTestRunner { return this.simulateMochaDryRun(mocha); } + if (abortSignal?.aborted) { + this.log.warning('run aborted'); + return; + } + await lifecycle.beforeTests.trigger(mocha.suite); - this.log.info('Starting tests'); + if (abortSignal?.aborted) { + this.log.warning('run aborted'); + return; + } - return await runTests(lifecycle, mocha); + this.log.info('Starting tests'); + return await runTests(lifecycle, mocha, abortSignal); }); } diff --git a/packages/kbn-test/src/functional_test_runner/lib/mocha/run_tests.ts b/packages/kbn-test/src/functional_test_runner/lib/mocha/run_tests.ts index 89f0ea088cac87..12840b77dd8d92 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/mocha/run_tests.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/mocha/run_tests.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import * as Rx from 'rxjs'; import { Lifecycle } from '../lifecycle'; import { Mocha } from '../../fake_mocha_types'; @@ -18,14 +19,23 @@ import { Mocha } from '../../fake_mocha_types'; * @param {Mocha} mocha * @return {Promise} resolves to the number of test failures */ -export async function runTests(lifecycle: Lifecycle, mocha: Mocha) { +export async function runTests(lifecycle: Lifecycle, mocha: Mocha, abortSignal?: AbortSignal) { let runComplete = false; const runner = mocha.run(() => { runComplete = true; }); - lifecycle.cleanup.add(() => { - if (!runComplete) runner.abort(); + Rx.race( + lifecycle.cleanup.before$, + abortSignal ? Rx.fromEvent(abortSignal, 'abort').pipe(Rx.take(1)) : Rx.NEVER + ).subscribe({ + next() { + if (!runComplete) { + runComplete = true; + runner.uncaught(new Error('Forcing mocha to abort')); + runner.abort(); + } + }, }); return new Promise((resolve) => { diff --git a/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts b/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts index adbb18b5312d0c..2ee9de4053fef9 100644 --- a/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts +++ b/packages/kbn-test/src/functional_tests/lib/run_elasticsearch.ts @@ -17,6 +17,7 @@ interface RunElasticsearchOptions { log: ToolingLog; esFrom?: string; config: Config; + onEarlyExit?: (msg: string) => void; } interface CcsConfig { @@ -92,7 +93,8 @@ export async function runElasticsearch( async function startEsNode( log: ToolingLog, name: string, - config: EsConfig & { transportPort?: number } + config: EsConfig & { transportPort?: number }, + onEarlyExit?: (msg: string) => void ) { const cluster = createTestEsCluster({ clusterName: `cluster-${name}`, @@ -112,6 +114,7 @@ async function startEsNode( }, ], transportPort: config.transportPort, + onEarlyExit, }); await cluster.start(); diff --git a/packages/kbn-test/src/functional_tests/lib/run_ftr.ts b/packages/kbn-test/src/functional_tests/lib/run_ftr.ts index 4c4a7128a05a9c..b9945adbdfb560 100644 --- a/packages/kbn-test/src/functional_tests/lib/run_ftr.ts +++ b/packages/kbn-test/src/functional_tests/lib/run_ftr.ts @@ -81,8 +81,8 @@ async function createFtr({ }; } -export async function assertNoneExcluded({ configPath, options }: CreateFtrParams) { - const { config, ftr } = await createFtr({ configPath, options }); +export async function assertNoneExcluded(params: CreateFtrParams) { + const { config, ftr } = await createFtr(params); if (config.get('testRunner')) { // tests with custom test runners are not included in this check @@ -95,21 +95,21 @@ export async function assertNoneExcluded({ configPath, options }: CreateFtrParam } if (stats.testsExcludedByTag.length > 0) { throw new CliError(` - ${stats.testsExcludedByTag.length} tests in the ${configPath} config + ${stats.testsExcludedByTag.length} tests in the ${params.configPath} config are excluded when filtering by the tags run on CI. Make sure that all suites are tagged with one of the following tags: - ${JSON.stringify(options.suiteTags)} + ${JSON.stringify(params.options.suiteTags)} - ${stats.testsExcludedByTag.join('\n - ')} `); } } -export async function runFtr({ configPath, options }: CreateFtrParams) { - const { ftr } = await createFtr({ configPath, options }); +export async function runFtr(params: CreateFtrParams, signal?: AbortSignal) { + const { ftr } = await createFtr(params); - const failureCount = await ftr.run(); + const failureCount = await ftr.run(signal); if (failureCount > 0) { throw new CliError( `${failureCount} functional test ${failureCount === 1 ? 'failure' : 'failures'}` @@ -117,8 +117,8 @@ export async function runFtr({ configPath, options }: CreateFtrParams) { } } -export async function hasTests({ configPath, options }: CreateFtrParams) { - const { ftr, config } = await createFtr({ configPath, options }); +export async function hasTests(params: CreateFtrParams) { + const { ftr, config } = await createFtr(params); if (config.get('testRunner')) { // configs with custom test runners are assumed to always have tests diff --git a/packages/kbn-test/src/functional_tests/lib/run_kibana_server.ts b/packages/kbn-test/src/functional_tests/lib/run_kibana_server.ts index 47d0b1c93b620b..b5026d397139d8 100644 --- a/packages/kbn-test/src/functional_tests/lib/run_kibana_server.ts +++ b/packages/kbn-test/src/functional_tests/lib/run_kibana_server.ts @@ -31,10 +31,12 @@ export async function runKibanaServer({ procs, config, options, + onEarlyExit, }: { procs: ProcRunner; config: Config; options: { installDir?: string; extraKbnOpts?: string[] }; + onEarlyExit?: (msg: string) => void; }) { const runOptions = config.get('kbnTestServer.runOptions'); const installDir = runOptions.alwaysUseSource ? undefined : options.installDir; @@ -51,6 +53,7 @@ export async function runKibanaServer({ }, cwd: installDir || KIBANA_ROOT, wait: runOptions.wait, + onEarlyExit, }); } diff --git a/packages/kbn-test/src/functional_tests/tasks.ts b/packages/kbn-test/src/functional_tests/tasks.ts index dd9fe4c93016c4..33a49ae2c80d1a 100644 --- a/packages/kbn-test/src/functional_tests/tasks.ts +++ b/packages/kbn-test/src/functional_tests/tasks.ts @@ -107,14 +107,26 @@ export async function runTests(options: RunTestsParams) { await withProcRunner(log, async (procs) => { const config = await readConfigFile(log, options.esVersion, configPath); + const abortCtrl = new AbortController(); + + const onEarlyExit = (msg: string) => { + log.error(msg); + abortCtrl.abort(); + }; let shutdownEs; try { if (process.env.TEST_ES_DISABLE_STARTUP !== 'true') { - shutdownEs = await runElasticsearch({ ...options, log, config }); + shutdownEs = await runElasticsearch({ ...options, log, config, onEarlyExit }); + if (abortCtrl.signal.aborted) { + return; + } + } + await runKibanaServer({ procs, config, options, onEarlyExit }); + if (abortCtrl.signal.aborted) { + return; } - await runKibanaServer({ procs, config, options }); - await runFtr({ configPath, options: { ...options, log } }); + await runFtr({ configPath, options: { ...options, log } }, abortCtrl.signal); } finally { try { const delay = config.get('kbnTestServer.delayShutdown'); diff --git a/x-pack/plugins/fleet/common/types/models/agent.ts b/x-pack/plugins/fleet/common/types/models/agent.ts index 018f591fef79c8..68c2a0ecb7d885 100644 --- a/x-pack/plugins/fleet/common/types/models/agent.ts +++ b/x-pack/plugins/fleet/common/types/models/agent.ts @@ -104,6 +104,7 @@ interface AgentBase { last_checkin_status?: 'error' | 'online' | 'degraded' | 'updating'; user_provided_metadata: AgentMetadata; local_metadata: AgentMetadata; + tags?: string[]; } export interface Agent extends AgentBase { @@ -216,6 +217,10 @@ export interface FleetServerAgent { * The last acknowledged action sequence number for the Elastic Agent */ action_seq_no?: number; + /** + * A list of tags used for organizing/filtering agents + */ + tags?: string[]; } /** * An Elastic Agent metadata diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx index a511c2dc9f3da9..60a97845312e8b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx @@ -70,6 +70,9 @@ export const SearchAndFilterBar: React.FunctionComponent<{ onSelectedStatusChange: (selectedStatus: string[]) => void; showUpgradeable: boolean; onShowUpgradeableChange: (showUpgradeable: boolean) => void; + tags: string[]; + selectedTags: string[]; + onSelectedTagsChange: (selectedTags: string[]) => void; totalAgents: number; totalInactiveAgents: number; selectionMode: SelectionMode; @@ -87,6 +90,9 @@ export const SearchAndFilterBar: React.FunctionComponent<{ onSelectedStatusChange, showUpgradeable, onShowUpgradeableChange, + tags, + selectedTags, + onSelectedTagsChange, totalAgents, totalInactiveAgents, selectionMode, @@ -100,7 +106,9 @@ export const SearchAndFilterBar: React.FunctionComponent<{ const [isAgentPoliciesFilterOpen, setIsAgentPoliciesFilterOpen] = useState(false); // Status for filtering - const [isStatusFilterOpen, setIsStatutsFilterOpen] = useState(false); + const [isStatusFilterOpen, setIsStatusFilterOpen] = useState(false); + + const [isTagsFilterOpen, setIsTagsFilterOpen] = useState(false); // Add a agent policy id to current search const addAgentPolicyFilter = (policyId: string) => { @@ -114,6 +122,14 @@ export const SearchAndFilterBar: React.FunctionComponent<{ ); }; + const addTagsFilter = (tag: string) => { + onSelectedTagsChange([...selectedTags, tag]); + }; + + const removeTagsFilter = (tag: string) => { + onSelectedTagsChange(selectedTags.filter((t) => t !== tag)); + }; + return ( <> {isEnrollmentFlyoutOpen ? ( @@ -146,7 +162,7 @@ export const SearchAndFilterBar: React.FunctionComponent<{ button={ setIsStatutsFilterOpen(!isStatusFilterOpen)} + onClick={() => setIsStatusFilterOpen(!isStatusFilterOpen)} isSelected={isStatusFilterOpen} hasActiveFilters={selectedStatus.length > 0} disabled={agentPolicies.length === 0} @@ -159,7 +175,7 @@ export const SearchAndFilterBar: React.FunctionComponent<{ } isOpen={isStatusFilterOpen} - closePopover={() => setIsStatutsFilterOpen(false)} + closePopover={() => setIsStatusFilterOpen(false)} panelPaddingSize="none" >
@@ -180,6 +196,46 @@ export const SearchAndFilterBar: React.FunctionComponent<{ ))}
+ setIsTagsFilterOpen(!isTagsFilterOpen)} + isSelected={isTagsFilterOpen} + hasActiveFilters={selectedTags.length > 0} + numFilters={selectedTags.length} + disabled={tags.length === 0} + data-test-subj="agentList.tagsFilter" + > + + + } + isOpen={isTagsFilterOpen} + closePopover={() => setIsTagsFilterOpen(false)} + panelPaddingSize="none" + > +
+ {tags.map((tag, index) => ( + { + if (selectedTags.includes(tag)) { + removeTagsFilter(tag); + } else { + addTagsFilter(tag); + } + }} + > + {tag} + + ))} +
+
{ + describe('when list is short', () => { + it('renders a comma-separated list of tags', () => { + const tags = ['tag1', 'tag2']; + render(); + + expect(screen.getByTestId('agentTags')).toHaveTextContent('tag1, tag2'); + }); + }); + + describe('when list is long', () => { + it('renders a truncated list of tags with full list displayed in tooltip on hover', async () => { + const tags = ['tag1', 'tag2', 'tag3', 'tag4', 'tag5']; + render(); + + const tagsNode = screen.getByTestId('agentTags'); + + expect(tagsNode).toHaveTextContent('tag1, tag2, tag3 + 2 more'); + + fireEvent.mouseEnter(tagsNode); + await waitFor(() => { + screen.getByTestId('agentTagsTooltip'); + }); + + expect(screen.getByTestId('agentTagsTooltip')).toHaveTextContent( + 'tag1, tag2, tag3, tag4, tag5' + ); + }); + }); +}); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/tags.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/tags.tsx new file mode 100644 index 00000000000000..7650b0d942180a --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/tags.tsx @@ -0,0 +1,34 @@ +/* + * 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 { EuiToolTip } from '@elastic/eui'; +import { take } from 'lodash'; +import React from 'react'; + +interface Props { + tags: string[]; +} + +const MAX_TAGS_TO_DISPLAY = 3; + +export const Tags: React.FunctionComponent = ({ tags }) => { + return ( + <> + {tags.length > MAX_TAGS_TO_DISPLAY ? ( + <> + {tags.join(', ')}}> + + {take(tags, 3).join(', ')} + {tags.length - MAX_TAGS_TO_DISPLAY} more + + + + ) : ( + {tags.join(', ')} + )} + + ); +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx index 5776a163fd6a3d..510be94ab1705a 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/index.tsx @@ -50,6 +50,7 @@ import { agentFlyoutContext } from '..'; import { AgentTableHeader } from './components/table_header'; import type { SelectionMode } from './components/types'; import { SearchAndFilterBar } from './components/search_and_filter_bar'; +import { Tags } from './components/tags'; import { TableRowActions } from './components/table_row_actions'; import { EmptyPrompt } from './components/empty_prompt'; @@ -98,14 +99,21 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { // Status for filtering const [selectedStatus, setSelectedStatus] = useState([]); + const [selectedTags, setSelectedTags] = useState([]); + const isUsingFilter = - search.trim() || selectedAgentPolicies.length || selectedStatus.length || showUpgradeable; + search.trim() || + selectedAgentPolicies.length || + selectedStatus.length || + selectedTags.length || + showUpgradeable; const clearFilters = useCallback(() => { setDraftKuery(''); setSearch(''); setSelectedAgentPolicies([]); setSelectedStatus([]); + setSelectedTags([]); setShowUpgradeable(false); }, [setSearch, setDraftKuery, setSelectedAgentPolicies, setSelectedStatus, setShowUpgradeable]); @@ -135,6 +143,13 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { .map((agentPolicy) => `"${agentPolicy}"`) .join(' or ')})`; } + + if (selectedTags.length) { + kueryBuilder = `${kueryBuilder} ${AGENTS_PREFIX}.tags : (${selectedTags + .map((tag) => `"${tag}"`) + .join(' or ')})`; + } + if (selectedStatus.length) { const kueryStatus = selectedStatus .map((status) => { @@ -164,7 +179,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { } return kueryBuilder; - }, [selectedStatus, selectedAgentPolicies, search]); + }, [search, selectedAgentPolicies, selectedTags, selectedStatus]); const showInactive = useMemo(() => { return selectedStatus.includes('inactive'); @@ -174,6 +189,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { const [agentsStatus, setAgentsStatus] = useState< { [key in SimplifiedAgentStatus]: number } | undefined >(); + const [allTags, setAllTags] = useState(); const [isLoading, setIsLoading] = useState(false); const [totalAgents, setTotalAgents] = useState(0); const [totalInactiveAgents, setTotalInactiveAgents] = useState(0); @@ -224,6 +240,16 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { inactive: agentsRequest.data.totalInactive, }); + // Only set tags on the first request - we don't want the list of tags to update based + // on the returned set of agents from the API + if (allTags === undefined) { + const newAllTags = Array.from( + new Set(agentsRequest.data.items.flatMap((agent) => agent.tags ?? [])) + ); + + setAllTags(newAllTags); + } + setAgents(agentsRequest.data.items); setTotalAgents(agentsRequest.data.total); setTotalInactiveAgents(agentsRequest.data.totalInactive); @@ -237,7 +263,15 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { setIsLoading(false); } fetchDataAsync(); - }, [pagination, kuery, showInactive, showUpgradeable, notifications.toasts]); + }, [ + pagination.currentPage, + pagination.pageSize, + kuery, + showInactive, + showUpgradeable, + allTags, + notifications.toasts, + ]); // Send request to get agent list and status useEffect(() => { @@ -319,6 +353,14 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { }), render: (active: boolean, agent: any) => , }, + { + field: 'tags', + width: '240px', + name: i18n.translate('xpack.fleet.agentList.tagsColumnTitle', { + defaultMessage: 'Tags', + }), + render: (tags: string[] = [], agent: any) => , + }, { field: 'policy_id', name: i18n.translate('xpack.fleet.agentList.policyColumnTitle', { @@ -481,6 +523,9 @@ export const AgentListPage: React.FunctionComponent<{}> = () => { onSelectedStatusChange={setSelectedStatus} showUpgradeable={showUpgradeable} onShowUpgradeableChange={setShowUpgradeable} + tags={allTags ?? []} + selectedTags={selectedTags} + onSelectedTagsChange={setSelectedTags} totalAgents={totalAgents} totalInactiveAgents={totalInactiveAgents} selectionMode={selectionMode} diff --git a/x-pack/plugins/ml/readme.md b/x-pack/plugins/ml/readme.md index 7bd1a1a221edd5..9b155e5f7696c7 100644 --- a/x-pack/plugins/ml/readme.md +++ b/x-pack/plugins/ml/readme.md @@ -104,42 +104,49 @@ Run the following commands from the `x-pack` directory and use separate terminal for test server and test runner. The test server command starts an Elasticsearch and Kibana instance that the tests will be run against. -1. Functional UI tests with `Trial` license (default config): - - node scripts/functional_tests_server.js - node scripts/functional_test_runner.js --include-tag mlqa - - ML functional `Trial` license tests are located in `x-pack/test/functional/apps/ml`. - +Functional tests are broken up into independent groups with their own configuration. +Test server and runner need to be pointed to the configuration to run. The basic +commands are + + node scripts/functional_tests_server.js --config PATH_TO_CONFIG + node scripts/functional_test_runner.js --config PATH_TO_CONFIG + +With PATH_TO_CONFIG and other options as follows. + +1. Functional UI tests with `Trial` license: + + Group | PATH_TO_CONFIG + ----- | -------------- + anomaly detection | `test/functional/apps/ml/anomaly_detection/config.ts` + data frame analytics | `test/functional/apps/ml/anomaly_detection/config.ts` + data visualizer | `test/functional/apps/ml/data_frame_analytics/config.ts` + permissions | `test/functional/apps/ml/permissions/config.ts` + stack management jobs | `test/functional/apps/ml/stack_management_jobs/config.ts` + short tests | `test/functional/apps/ml/short_tests/config.ts` + + The `short tests` group contains tests for page navigation, model management, + feature controls, settings and embeddables. Test files for each group are located + in the directory of their copnfiguration file. + 1. Functional UI tests with `Basic` license: - node scripts/functional_tests_server.js --config test/functional_basic/config.ts - node scripts/functional_test_runner.js --config test/functional_basic/config.ts --include-tag mlqa - - ML functional `Basic` license tests are located in `x-pack/test/functional_basic/apps/ml`. + - PATH_TO_CONFIG: `test/functional_basic/config.ts` + - Add `--include-tag ml` to the test runner command + - Tests are located in `x-pack/test/functional_basic/apps/ml` 1. API integration tests with `Trial` license: - node scripts/functional_tests_server.js - node scripts/functional_test_runner.js --config test/api_integration/config.ts --include-tag mlqa - - ML API integration `Trial` license tests are located in `x-pack/test/api_integration/apis/ml`. - -1. API integration tests with `Basic` license: - - node scripts/functional_tests_server.js --config test/api_integration_basic/config.ts - node scripts/functional_test_runner.js --config test/api_integration_basic/config.ts --include-tag mlqa - - ML API integration `Basic` license tests are located in `x-pack/test/api_integration_basic/apis/ml`. + - PATH_TO_CONFIG: `test/api_integration/config.ts` + - Add `--include-tag ml` to the test runner command + - Tests are located in `x-pack/test/api_integration/apis/ml` 1. Accessibility tests: We maintain a suite of accessibility tests (you may see them referred to elsewhere as `a11y` tests). These tests render each of our pages and ensure that the inputs and other elements contain the attributes necessary to ensure all users are able to make use of ML (for example, users relying on screen readers). - node scripts/functional_tests_server --config test/accessibility/config.ts - node scripts/functional_test_runner.js --config test/accessibility/config.ts --grep=ml - - ML accessibility tests are located in `x-pack/test/accessibility/apps`. + - PATH_TO_CONFIG: `test/accessibility/config.ts` + - Add `--grep=ml` to the test runner command + - Tests are located in `x-pack/test/accessibility/apps` ## Generating docs screenshots @@ -151,7 +158,7 @@ for test server and test runner. The test server command starts an Elasticsearch and Kibana instance that the tests will be run against. node scripts/functional_tests_server.js --config test/screenshot_creation/config.ts - node scripts/functional_test_runner.js --config test/screenshot_creation/config.ts --include-tag mlqa + node scripts/functional_test_runner.js --config test/screenshot_creation/config.ts --include-tag ml The generated screenshots are stored in `x-pack/test/functional/screenshots/session/ml_docs`. ML screenshot generation tests are located in `x-pack/test/screenshot_creation/apps/ml_docs`. diff --git a/x-pack/plugins/transform/readme.md b/x-pack/plugins/transform/readme.md index 51a89f224fb294..8a0ea7eb4f660c 100644 --- a/x-pack/plugins/transform/readme.md +++ b/x-pack/plugins/transform/readme.md @@ -106,8 +106,8 @@ and Kibana instance that the tests will be run against. 1. Functional UI tests with `Trial` license (default config): - node scripts/functional_tests_server.js - node scripts/functional_test_runner.js --include-tag transform + node scripts/functional_tests_server.js --config test/functional/apps/transform/config.ts + node scripts/functional_test_runner.js --config test/functional/apps/transform/config.ts Transform functional `Trial` license tests are located in `x-pack/test/functional/apps/transform`. @@ -120,7 +120,7 @@ and Kibana instance that the tests will be run against. 1. API integration tests with `Trial` license: - node scripts/functional_tests_server.js + node scripts/functional_tests_server.js --config test/api_integration/config.ts node scripts/functional_test_runner.js --config test/api_integration/config.ts --include-tag transform Transform API integration `Trial` license tests are located in `x-pack/test/api_integration/apis/transform`. diff --git a/x-pack/test/api_integration/apis/ml/index.ts b/x-pack/test/api_integration/apis/ml/index.ts index 6a36bf756cf19d..c504811fcd0ce2 100644 --- a/x-pack/test/api_integration/apis/ml/index.ts +++ b/x-pack/test/api_integration/apis/ml/index.ts @@ -12,7 +12,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const ml = getService('ml'); describe('Machine Learning', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await ml.securityCommon.createMlRoles(); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/advanced_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/advanced_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/advanced_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/advanced_job.ts index ba0d030cfcf6f9..c809d0ee5c20d9 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/advanced_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/advanced_job.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; interface Detector { identifier: string; @@ -220,7 +220,7 @@ export default function ({ getService }: FtrProviderContext) { const calendarId = `wizard-test-calendar_${Date.now()}`; describe('advanced job', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce'); await ml.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/aggregated_scripted_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/aggregated_scripted_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/aggregated_scripted_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/aggregated_scripted_job.ts index 78974ecf1e64ca..0740c365f02e2a 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/aggregated_scripted_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/aggregated_scripted_job.ts @@ -6,7 +6,7 @@ */ import { Datafeed, Job } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -360,7 +360,7 @@ export default function ({ getService }: FtrProviderContext) { ]; describe('aggregated or scripted job', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/annotations.ts b/x-pack/test/functional/apps/ml/anomaly_detection/annotations.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/annotations.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/annotations.ts index 17c576281835a9..05e38d565e9697 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/annotations.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/annotations.ts @@ -6,14 +6,14 @@ */ import { Annotation } from '@kbn/ml-plugin/common/types/annotations'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); describe('annotations', function () { - this.tags(['mlqa']); + this.tags(['ml']); const jobId = `fq_single_1_smv_${Date.now()}`; const annotation = { diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/anomaly_explorer.ts b/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/anomaly_explorer.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts index c71f4a5789fd22..6e3e98171b1099 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/anomaly_explorer.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/anomaly_explorer.ts @@ -6,7 +6,7 @@ */ import { Job, Datafeed } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; // @ts-expect-error not full interface const JOB_CONFIG: Job = { @@ -64,7 +64,7 @@ export default function ({ getService }: FtrProviderContext) { const elasticChart = getService('elasticChart'); describe('anomaly explorer', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/categorization_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/categorization_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts index 96c02f7827a587..2ee9d226596d8f 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/categorization_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts @@ -6,7 +6,7 @@ */ import { CATEGORY_EXAMPLES_VALIDATION_STATUS } from '@kbn/ml-plugin/common/constants/categorization_job'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -75,7 +75,7 @@ export default function ({ getService }: FtrProviderContext) { const calendarId = `wizard-test-calendar_${Date.now()}`; describe('categorization', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/categorization_small'); await ml.testResources.createIndexPatternIfNeeded('ft_categorization_small', '@timestamp'); diff --git a/x-pack/test/functional/apps/ml/group3/config.ts b/x-pack/test/functional/apps/ml/anomaly_detection/config.ts similarity index 85% rename from x-pack/test/functional/apps/ml/group3/config.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/config.ts index d927f93adeffd0..9078782e36f0b5 100644 --- a/x-pack/test/functional/apps/ml/group3/config.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/config.ts @@ -13,5 +13,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...functionalConfig.getAll(), testFiles: [require.resolve('.')], + junit: { + reportName: 'Chrome X-Pack UI Functional Tests - ML anomaly_detection', + }, }; } diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/custom_urls.ts b/x-pack/test/functional/apps/ml/anomaly_detection/custom_urls.ts similarity index 97% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/custom_urls.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/custom_urls.ts index 1e6e020aff69c6..7920cf9721d47d 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/custom_urls.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/custom_urls.ts @@ -7,12 +7,12 @@ import { Job, Datafeed } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; import { TIME_RANGE_TYPE } from '@kbn/ml-plugin/public/application/jobs/components/custom_url_editor/constants'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; import type { DiscoverUrlConfig, DashboardUrlConfig, OtherUrlConfig, -} from '../../../../services/ml/job_table'; +} from '../../../services/ml/job_table'; // @ts-expect-error doesn't implement the full interface const JOB_CONFIG: Job = { @@ -63,7 +63,7 @@ export default function ({ getService }: FtrProviderContext) { const browser = getService('browser'); describe('custom urls', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/date_nanos_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/date_nanos_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/date_nanos_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/date_nanos_job.ts index 4b593aacbebf11..ed9f63be66dd4b 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/date_nanos_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/date_nanos_job.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; interface Detector { identifier: string; @@ -115,7 +115,7 @@ export default function ({ getService }: FtrProviderContext) { ]; describe('job on data set with date_nanos time field', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/event_rate_nanos'); await ml.testResources.createIndexPatternIfNeeded( diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/forecasts.ts b/x-pack/test/functional/apps/ml/anomaly_detection/forecasts.ts similarity index 97% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/forecasts.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/forecasts.ts index b290789419ed88..93ec331230a8a0 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/forecasts.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/forecasts.ts @@ -6,7 +6,7 @@ */ import { Job, Datafeed } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; // @ts-expect-error not full interface const JOB_CONFIG: Job = { @@ -40,7 +40,7 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); describe('forecasts', function () { - this.tags(['mlqa']); + this.tags(['ml']); describe('with single metric job', function () { before(async () => { diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/index.ts b/x-pack/test/functional/apps/ml/anomaly_detection/index.ts similarity index 51% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/index.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/index.ts index a1127c0e71c77c..0b206bfc450f31 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/index.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/index.ts @@ -5,12 +5,35 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; -export default function ({ loadTestFile }: FtrProviderContext) { - describe('anomaly detection', function () { +export default function ({ getService, loadTestFile }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const ml = getService('ml'); + + describe('machine learning - anomaly detection', function () { this.tags(['skipFirefox']); + before(async () => { + await ml.securityCommon.createMlRoles(); + await ml.securityCommon.createMlUsers(); + }); + + after(async () => { + // NOTE: Logout needs to happen before anything else to avoid flaky behavior + await ml.securityUI.logout(); + + await ml.securityCommon.cleanMlUsers(); + await ml.securityCommon.cleanMlRoles(); + + await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote'); + await esArchiver.unload('x-pack/test/functional/es_archives/ml/ecommerce'); + await esArchiver.unload('x-pack/test/functional/es_archives/ml/categorization_small'); + await esArchiver.unload('x-pack/test/functional/es_archives/ml/event_rate_nanos'); + + await ml.testResources.resetKibanaTimeZone(); + }); + loadTestFile(require.resolve('./single_metric_job')); loadTestFile(require.resolve('./single_metric_job_without_datafeed_start')); loadTestFile(require.resolve('./multi_metric_job')); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/multi_metric_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/multi_metric_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/multi_metric_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/multi_metric_job.ts index 783312b0d8608b..dcb47b205bb1b9 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/multi_metric_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/multi_metric_job.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -72,7 +72,7 @@ export default function ({ getService }: FtrProviderContext) { const calendarId = `wizard-test-calendar_${Date.now()}`; describe('multi metric', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/population_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/population_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/population_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/population_job.ts index af2573e21f93de..0d04bb2ff70645 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/population_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/population_job.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -86,7 +86,7 @@ export default function ({ getService }: FtrProviderContext) { const calendarId = `wizard-test-calendar_${Date.now()}`; describe('population', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce'); await ml.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/saved_search_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/saved_search_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/saved_search_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/saved_search_job.ts index 72dbac602cf8f1..7d9c528d763d74 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/saved_search_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/saved_search_job.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -266,7 +266,7 @@ export default function ({ getService }: FtrProviderContext) { ]; describe('saved search', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_job.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts index e698dd270e1a87..cb21f8de77bd25 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -72,7 +72,7 @@ export default function ({ getService }: FtrProviderContext) { const calendarId = `wizard-test-calendar_${Date.now()}`; describe('single metric', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_job_without_datafeed_start.ts b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job_without_datafeed_start.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_job_without_datafeed_start.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job_without_datafeed_start.ts index 2afa284fcc3d75..4cdea1a726fe9f 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_job_without_datafeed_start.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job_without_datafeed_start.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -57,7 +57,7 @@ export default function ({ getService }: FtrProviderContext) { } describe('single metric without datafeed start', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); diff --git a/x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_viewer.ts b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_viewer.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_viewer.ts rename to x-pack/test/functional/apps/ml/anomaly_detection/single_metric_viewer.ts index b970a0efe56023..809ebf204e2a7e 100644 --- a/x-pack/test/functional/apps/ml/group2/anomaly_detection/single_metric_viewer.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_viewer.ts @@ -6,7 +6,7 @@ */ import { Job, Datafeed } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; // @ts-expect-error not full interface const JOB_CONFIG: Job = { @@ -41,7 +41,7 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); describe('single metric viewer', function () { - this.tags(['mlqa']); + this.tags(['ml']); describe('with single metric job', function () { before(async () => { diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/classification_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/classification_creation.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts index 0cf7c4177f057f..2ba4ac6f08350d 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/classification_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AnalyticsTableRowDetails } from '../../../../services/ml/data_frame_analytics_table'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { AnalyticsTableRowDetails } from '../../../services/ml/data_frame_analytics_table'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/classification_creation_saved_search.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation_saved_search.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/classification_creation_saved_search.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation_saved_search.ts index cfba10c25b17b3..67550ae17a4b06 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/classification_creation_saved_search.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation_saved_search.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AnalyticsTableRowDetails } from '../../../../services/ml/data_frame_analytics_table'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { AnalyticsTableRowDetails } from '../../../services/ml/data_frame_analytics_table'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/cloning.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/cloning.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts index 82f76e66b4ebd5..3a33c95edba423 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/cloning.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import { DeepPartial } from '@kbn/ml-plugin/common/types/common'; import { DataFrameAnalyticsConfig } from '@kbn/ml-plugin/public/application/data_frame_analytics/common'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/config.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/config.ts new file mode 100644 index 00000000000000..e82782f89973e0 --- /dev/null +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/config.ts @@ -0,0 +1,20 @@ +/* + * 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 { FtrConfigProviderContext } from '@kbn/test'; + +export default async function ({ readConfigFile }: FtrConfigProviderContext) { + const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js')); + + return { + ...functionalConfig.getAll(), + testFiles: [require.resolve('.')], + junit: { + reportName: 'Chrome X-Pack UI Functional Tests - ML data_frame_analytics', + }, + }; +} diff --git a/x-pack/test/functional/apps/ml/group1/index.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/index.ts similarity index 64% rename from x-pack/test/functional/apps/ml/group1/index.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/index.ts index 7129f3e24d4f1e..19844632cc4115 100644 --- a/x-pack/test/functional/apps/ml/group1/index.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/index.ts @@ -11,7 +11,9 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); - describe('machine learning - group 2', () => { + describe('machine learning - data frame analytics', function () { + this.tags(['ml', 'skipFirefox']); + before(async () => { await ml.securityCommon.createMlRoles(); await ml.securityCommon.createMlUsers(); @@ -24,22 +26,21 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { await ml.securityCommon.cleanMlUsers(); await ml.securityCommon.cleanMlRoles(); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/ecommerce'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/categorization_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/event_rate_nanos'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/bm_classification'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/ihp_outlier'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/egs_regression'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_sample_ecommerce'); await ml.testResources.resetKibanaTimeZone(); }); - loadTestFile(require.resolve('./permissions')); - loadTestFile(require.resolve('./pages')); - loadTestFile(require.resolve('./data_frame_analytics')); - loadTestFile(require.resolve('./model_management')); + loadTestFile(require.resolve('./outlier_detection_creation')); + loadTestFile(require.resolve('./regression_creation')); + loadTestFile(require.resolve('./classification_creation')); + loadTestFile(require.resolve('./cloning')); + loadTestFile(require.resolve('./results_view_content')); + loadTestFile(require.resolve('./regression_creation_saved_search')); + loadTestFile(require.resolve('./classification_creation_saved_search')); + loadTestFile(require.resolve('./outlier_detection_creation_saved_search')); }); } diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/outlier_detection_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/outlier_detection_creation.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts index e9146ce5484223..947cd82cdd3423 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/outlier_detection_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; -import { AnalyticsTableRowDetails } from '../../../../services/ml/data_frame_analytics_table'; +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { AnalyticsTableRowDetails } from '../../../services/ml/data_frame_analytics_table'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/outlier_detection_creation_saved_search.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation_saved_search.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/outlier_detection_creation_saved_search.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation_saved_search.ts index 1e428531e6aa96..1dc431c74a97de 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/outlier_detection_creation_saved_search.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation_saved_search.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AnalyticsTableRowDetails } from '../../../../services/ml/data_frame_analytics_table'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { AnalyticsTableRowDetails } from '../../../services/ml/data_frame_analytics_table'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/regression_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/regression_creation.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts index a0cbd123b51694..7a84c41aa4a661 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/regression_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; -import { AnalyticsTableRowDetails } from '../../../../services/ml/data_frame_analytics_table'; +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { AnalyticsTableRowDetails } from '../../../services/ml/data_frame_analytics_table'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/regression_creation_saved_search.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation_saved_search.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/regression_creation_saved_search.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation_saved_search.ts index 6b09b35c610a07..e22c4908486d18 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/regression_creation_saved_search.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation_saved_search.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { AnalyticsTableRowDetails } from '../../../../services/ml/data_frame_analytics_table'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { AnalyticsTableRowDetails } from '../../../services/ml/data_frame_analytics_table'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/results_view_content.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/results_view_content.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group1/data_frame_analytics/results_view_content.ts rename to x-pack/test/functional/apps/ml/data_frame_analytics/results_view_content.ts index 8d04c4897dab0c..2bddf0a7d95125 100644 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/results_view_content.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/results_view_content.ts @@ -8,7 +8,7 @@ import { DeepPartial } from '@kbn/ml-plugin/common/types/common'; import { DataFrameAnalyticsConfig } from '@kbn/ml-plugin/public/application/data_frame_analytics/common'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/functional/apps/ml/data_visualizer/config.ts b/x-pack/test/functional/apps/ml/data_visualizer/config.ts index d927f93adeffd0..daad4e85a1f8be 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/config.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/config.ts @@ -13,5 +13,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...functionalConfig.getAll(), testFiles: [require.resolve('.')], + junit: { + reportName: 'Chrome X-Pack UI Functional Tests - ML data_visualizer', + }, }; } diff --git a/x-pack/test/functional/apps/ml/data_visualizer/file_data_visualizer.ts b/x-pack/test/functional/apps/ml/data_visualizer/file_data_visualizer.ts index ef15775f862046..5e529a3430606a 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/file_data_visualizer.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/file_data_visualizer.ts @@ -208,7 +208,7 @@ export default function ({ getService }: FtrProviderContext) { ]; describe('file based', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await ml.testResources.setKibanaTimeZoneToUTC(); diff --git a/x-pack/test/functional/apps/ml/data_visualizer/index.ts b/x-pack/test/functional/apps/ml/data_visualizer/index.ts index 973ebf2bbe3ab3..a75fc8d0bf794e 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/index.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/index.ts @@ -12,7 +12,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const ml = getService('ml'); describe('machine learning - data visualizer', function () { - this.tags(['skipFirefox', 'mlqa']); + this.tags(['skipFirefox', 'ml']); before(async () => { await ml.securityCommon.createMlRoles(); @@ -27,14 +27,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { await ml.securityCommon.cleanMlRoles(); await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/ecommerce'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/categorization_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/event_rate_nanos'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/bm_classification'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/ihp_outlier'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/egs_regression'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_sample_ecommerce'); + await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_sample_logs'); await ml.testResources.resetKibanaTimeZone(); }); diff --git a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer.ts b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer.ts index 4334e72e9a16ec..1f4c20ea6faa53 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer.ts @@ -154,7 +154,7 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { } describe('index based', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/module_sample_logs'); diff --git a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts index b3f0e9e175d7a5..c7e00f8ed5b548 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts @@ -12,7 +12,7 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); describe('index based actions panel on trial license', function () { - this.tags(['mlqa']); + this.tags(['ml']); const indexPatternName = 'ft_farequote'; diff --git a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_index_pattern_management.ts b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_index_pattern_management.ts index 6ddf3bba3a81f0..0017a71a086feb 100644 --- a/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_index_pattern_management.ts +++ b/x-pack/test/functional/apps/ml/data_visualizer/index_data_visualizer_index_pattern_management.ts @@ -173,7 +173,7 @@ export default function ({ getService }: FtrProviderContext) { } describe('data view management', function () { - this.tags(['mlqa']); + this.tags(['ml']); const indexPatternTitle = 'ft_farequote'; before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); diff --git a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/index.ts b/x-pack/test/functional/apps/ml/group1/data_frame_analytics/index.ts deleted file mode 100644 index cf9bd17f11b814..00000000000000 --- a/x-pack/test/functional/apps/ml/group1/data_frame_analytics/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 { FtrProviderContext } from '../../../../ftr_provider_context'; - -export default function ({ loadTestFile }: FtrProviderContext) { - describe('data frame analytics', function () { - this.tags(['mlqa', 'skipFirefox']); - - loadTestFile(require.resolve('./outlier_detection_creation')); - loadTestFile(require.resolve('./regression_creation')); - loadTestFile(require.resolve('./classification_creation')); - loadTestFile(require.resolve('./cloning')); - loadTestFile(require.resolve('./results_view_content')); - loadTestFile(require.resolve('./regression_creation_saved_search')); - loadTestFile(require.resolve('./classification_creation_saved_search')); - loadTestFile(require.resolve('./outlier_detection_creation_saved_search')); - }); -} diff --git a/x-pack/test/functional/apps/ml/group1/permissions/index.ts b/x-pack/test/functional/apps/ml/group1/permissions/index.ts deleted file mode 100644 index 23d7d6fe9e2b53..00000000000000 --- a/x-pack/test/functional/apps/ml/group1/permissions/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 { FtrProviderContext } from '../../../../ftr_provider_context'; - -export default function ({ loadTestFile }: FtrProviderContext) { - describe('permissions', function () { - this.tags(['skipFirefox']); - - loadTestFile(require.resolve('./full_ml_access')); - loadTestFile(require.resolve('./read_ml_access')); - loadTestFile(require.resolve('./no_ml_access')); - }); -} diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/index.ts b/x-pack/test/functional/apps/ml/group3/stack_management_jobs/index.ts deleted file mode 100644 index 4c4bedfeb9b768..00000000000000 --- a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 { FtrProviderContext } from '../../../../ftr_provider_context'; - -export default function ({ loadTestFile }: FtrProviderContext) { - describe('stack management jobs', function () { - this.tags(['mlqa', 'skipFirefox']); - - loadTestFile(require.resolve('./synchronize')); - loadTestFile(require.resolve('./manage_spaces')); - loadTestFile(require.resolve('./import_jobs')); - loadTestFile(require.resolve('./export_jobs')); - }); -} diff --git a/x-pack/test/functional/apps/ml/group1/config.ts b/x-pack/test/functional/apps/ml/permissions/config.ts similarity index 86% rename from x-pack/test/functional/apps/ml/group1/config.ts rename to x-pack/test/functional/apps/ml/permissions/config.ts index d927f93adeffd0..cc9fffd2c93f52 100644 --- a/x-pack/test/functional/apps/ml/group1/config.ts +++ b/x-pack/test/functional/apps/ml/permissions/config.ts @@ -13,5 +13,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...functionalConfig.getAll(), testFiles: [require.resolve('.')], + junit: { + reportName: 'Chrome X-Pack UI Functional Tests - ML permission', + }, }; } diff --git a/x-pack/test/functional/apps/ml/group1/permissions/full_ml_access.ts b/x-pack/test/functional/apps/ml/permissions/full_ml_access.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group1/permissions/full_ml_access.ts rename to x-pack/test/functional/apps/ml/permissions/full_ml_access.ts index c632ae48b3f885..18a6e130daed0d 100644 --- a/x-pack/test/functional/apps/ml/group1/permissions/full_ml_access.ts +++ b/x-pack/test/functional/apps/ml/permissions/full_ml_access.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; -import { USER } from '../../../../services/ml/security_common'; +import { USER } from '../../../services/ml/security_common'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -20,7 +20,7 @@ export default function ({ getService }: FtrProviderContext) { ]; describe('for user with full ML access', function () { - this.tags(['skipFirefox', 'mlqa']); + this.tags(['skipFirefox', 'ml']); describe('with no data loaded', function () { for (const testUser of testUsers) { @@ -122,7 +122,7 @@ export default function ({ getService }: FtrProviderContext) { const ecExpectedTotalCount = '287'; const uploadFilePath = require.resolve( - '../../data_visualizer/files_to_import/artificial_server_log' + '../data_visualizer/files_to_import/artificial_server_log' ); const expectedUploadFileTitle = 'artificial_server_log'; diff --git a/x-pack/test/functional/apps/ml/group3/index.ts b/x-pack/test/functional/apps/ml/permissions/index.ts similarity index 59% rename from x-pack/test/functional/apps/ml/group3/index.ts rename to x-pack/test/functional/apps/ml/permissions/index.ts index e85b95b274720d..8b28c9e6ccda44 100644 --- a/x-pack/test/functional/apps/ml/group3/index.ts +++ b/x-pack/test/functional/apps/ml/permissions/index.ts @@ -11,7 +11,9 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); - describe('machine learning - group 3', function () { + describe('machine learning - permissions', function () { + this.tags(['ml', 'skipFirefox']); + before(async () => { await ml.securityCommon.createMlRoles(); await ml.securityCommon.createMlUsers(); @@ -25,21 +27,14 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { await ml.securityCommon.cleanMlRoles(); await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/ecommerce'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/categorization_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/event_rate_nanos'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/bm_classification'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/ihp_outlier'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/egs_regression'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_sample_ecommerce'); await ml.testResources.resetKibanaTimeZone(); }); - loadTestFile(require.resolve('./feature_controls')); - loadTestFile(require.resolve('./settings')); - loadTestFile(require.resolve('./embeddables')); - loadTestFile(require.resolve('./stack_management_jobs')); + loadTestFile(require.resolve('./full_ml_access')); + loadTestFile(require.resolve('./read_ml_access')); + loadTestFile(require.resolve('./no_ml_access')); }); } diff --git a/x-pack/test/functional/apps/ml/group1/permissions/no_ml_access.ts b/x-pack/test/functional/apps/ml/permissions/no_ml_access.ts similarity index 92% rename from x-pack/test/functional/apps/ml/group1/permissions/no_ml_access.ts rename to x-pack/test/functional/apps/ml/permissions/no_ml_access.ts index 4a1c108b2fa5a8..1974a48e778413 100644 --- a/x-pack/test/functional/apps/ml/group1/permissions/no_ml_access.ts +++ b/x-pack/test/functional/apps/ml/permissions/no_ml_access.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; -import { USER } from '../../../../services/ml/security_common'; +import { USER } from '../../../services/ml/security_common'; export default function ({ getPageObjects, getService }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'error']); @@ -16,7 +16,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const testUsers = [{ user: USER.ML_UNAUTHORIZED, discoverAvailable: true }]; describe('for user with no ML access', function () { - this.tags(['skipFirefox', 'mlqa']); + this.tags(['skipFirefox', 'ml']); for (const testUser of testUsers) { describe(`(${testUser.user})`, function () { diff --git a/x-pack/test/functional/apps/ml/group1/permissions/read_ml_access.ts b/x-pack/test/functional/apps/ml/permissions/read_ml_access.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group1/permissions/read_ml_access.ts rename to x-pack/test/functional/apps/ml/permissions/read_ml_access.ts index a18a6075055a63..301fc5102a94f1 100644 --- a/x-pack/test/functional/apps/ml/group1/permissions/read_ml_access.ts +++ b/x-pack/test/functional/apps/ml/permissions/read_ml_access.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; -import { USER } from '../../../../services/ml/security_common'; +import { USER } from '../../../services/ml/security_common'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -19,7 +19,7 @@ export default function ({ getService }: FtrProviderContext) { ]; describe('for user with read ML access', function () { - this.tags(['skipFirefox', 'mlqa']); + this.tags(['skipFirefox', 'ml']); describe('with no data loaded', function () { for (const testUser of testUsers) { @@ -116,7 +116,7 @@ export default function ({ getService }: FtrProviderContext) { const ecExpectedTotalCount = '287'; const uploadFilePath = require.resolve( - '../../data_visualizer/files_to_import/artificial_server_log' + '../data_visualizer/files_to_import/artificial_server_log' ); const expectedUploadFileTitle = 'artificial_server_log'; diff --git a/x-pack/test/functional/apps/ml/group2/config.ts b/x-pack/test/functional/apps/ml/short_tests/config.ts similarity index 86% rename from x-pack/test/functional/apps/ml/group2/config.ts rename to x-pack/test/functional/apps/ml/short_tests/config.ts index d927f93adeffd0..33d37ecd714571 100644 --- a/x-pack/test/functional/apps/ml/group2/config.ts +++ b/x-pack/test/functional/apps/ml/short_tests/config.ts @@ -13,5 +13,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...functionalConfig.getAll(), testFiles: [require.resolve('.')], + junit: { + reportName: 'Chrome X-Pack UI Functional Tests - ML short_tests', + }, }; } diff --git a/x-pack/test/functional/apps/ml/group3/embeddables/anomaly_charts_dashboard_embeddables.ts b/x-pack/test/functional/apps/ml/short_tests/embeddables/anomaly_charts_dashboard_embeddables.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group3/embeddables/anomaly_charts_dashboard_embeddables.ts rename to x-pack/test/functional/apps/ml/short_tests/embeddables/anomaly_charts_dashboard_embeddables.ts index 68981de99fc9a8..ef674c1744a511 100644 --- a/x-pack/test/functional/apps/ml/group3/embeddables/anomaly_charts_dashboard_embeddables.ts +++ b/x-pack/test/functional/apps/ml/short_tests/embeddables/anomaly_charts_dashboard_embeddables.ts @@ -34,7 +34,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); describe('anomaly charts in dashboard', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); diff --git a/x-pack/test/functional/apps/ml/group3/embeddables/anomaly_embeddables_migration.ts b/x-pack/test/functional/apps/ml/short_tests/embeddables/anomaly_embeddables_migration.ts similarity index 99% rename from x-pack/test/functional/apps/ml/group3/embeddables/anomaly_embeddables_migration.ts rename to x-pack/test/functional/apps/ml/short_tests/embeddables/anomaly_embeddables_migration.ts index a4c50549f5aed2..8f3c30a15e5433 100644 --- a/x-pack/test/functional/apps/ml/group3/embeddables/anomaly_embeddables_migration.ts +++ b/x-pack/test/functional/apps/ml/short_tests/embeddables/anomaly_embeddables_migration.ts @@ -66,7 +66,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['common', 'timePicker', 'dashboard']); describe('anomaly embeddables migration in Dashboard', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); diff --git a/x-pack/test/functional/apps/ml/group3/embeddables/constants.ts b/x-pack/test/functional/apps/ml/short_tests/embeddables/constants.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/embeddables/constants.ts rename to x-pack/test/functional/apps/ml/short_tests/embeddables/constants.ts diff --git a/x-pack/test/functional/apps/ml/group3/embeddables/index.ts b/x-pack/test/functional/apps/ml/short_tests/embeddables/index.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/embeddables/index.ts rename to x-pack/test/functional/apps/ml/short_tests/embeddables/index.ts diff --git a/x-pack/test/functional/apps/ml/group3/feature_controls/index.ts b/x-pack/test/functional/apps/ml/short_tests/feature_controls/index.ts similarity index 93% rename from x-pack/test/functional/apps/ml/group3/feature_controls/index.ts rename to x-pack/test/functional/apps/ml/short_tests/feature_controls/index.ts index ab0988c424761f..657eb86e20c199 100644 --- a/x-pack/test/functional/apps/ml/group3/feature_controls/index.ts +++ b/x-pack/test/functional/apps/ml/short_tests/feature_controls/index.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('feature controls', function () { - this.tags(['skipFirefox', 'mlqa']); + this.tags(['skipFirefox', 'ml']); loadTestFile(require.resolve('./ml_security')); loadTestFile(require.resolve('./ml_spaces')); }); diff --git a/x-pack/test/functional/apps/ml/group3/feature_controls/ml_security.ts b/x-pack/test/functional/apps/ml/short_tests/feature_controls/ml_security.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/feature_controls/ml_security.ts rename to x-pack/test/functional/apps/ml/short_tests/feature_controls/ml_security.ts diff --git a/x-pack/test/functional/apps/ml/group3/feature_controls/ml_spaces.ts b/x-pack/test/functional/apps/ml/short_tests/feature_controls/ml_spaces.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/feature_controls/ml_spaces.ts rename to x-pack/test/functional/apps/ml/short_tests/feature_controls/ml_spaces.ts diff --git a/x-pack/test/functional/apps/ml/short_tests/index.ts b/x-pack/test/functional/apps/ml/short_tests/index.ts new file mode 100644 index 00000000000000..3c4cbbc0677bea --- /dev/null +++ b/x-pack/test/functional/apps/ml/short_tests/index.ts @@ -0,0 +1,38 @@ +/* + * 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 { FtrProviderContext } from '../../../ftr_provider_context'; + +export default function ({ getService, loadTestFile }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const ml = getService('ml'); + + describe('machine learning - short tests', function () { + before(async () => { + await ml.securityCommon.createMlRoles(); + await ml.securityCommon.createMlUsers(); + }); + + after(async () => { + // NOTE: Logout needs to happen before anything else to avoid flaky behavior + await ml.securityUI.logout(); + + await ml.securityCommon.cleanMlUsers(); + await ml.securityCommon.cleanMlRoles(); + + await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote'); + + await ml.testResources.resetKibanaTimeZone(); + }); + + loadTestFile(require.resolve('./pages')); + loadTestFile(require.resolve('./model_management')); + loadTestFile(require.resolve('./feature_controls')); + loadTestFile(require.resolve('./settings')); + loadTestFile(require.resolve('./embeddables')); + }); +} diff --git a/x-pack/test/functional/apps/ml/group1/model_management/index.ts b/x-pack/test/functional/apps/ml/short_tests/model_management/index.ts similarity index 92% rename from x-pack/test/functional/apps/ml/group1/model_management/index.ts rename to x-pack/test/functional/apps/ml/short_tests/model_management/index.ts index 5595486260deee..c20957beb1ea53 100644 --- a/x-pack/test/functional/apps/ml/group1/model_management/index.ts +++ b/x-pack/test/functional/apps/ml/short_tests/model_management/index.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('model management', function () { - this.tags(['mlqa', 'skipFirefox']); + this.tags(['ml', 'skipFirefox']); loadTestFile(require.resolve('./model_list')); }); diff --git a/x-pack/test/functional/apps/ml/group1/model_management/model_list.ts b/x-pack/test/functional/apps/ml/short_tests/model_management/model_list.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group1/model_management/model_list.ts rename to x-pack/test/functional/apps/ml/short_tests/model_management/model_list.ts diff --git a/x-pack/test/functional/apps/ml/group1/pages.ts b/x-pack/test/functional/apps/ml/short_tests/pages.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group1/pages.ts rename to x-pack/test/functional/apps/ml/short_tests/pages.ts index 2cc271e67194e5..d81b5933d77df5 100644 --- a/x-pack/test/functional/apps/ml/group1/pages.ts +++ b/x-pack/test/functional/apps/ml/short_tests/pages.ts @@ -11,7 +11,7 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); describe('page navigation', function () { - this.tags(['skipFirefox', 'mlqa']); + this.tags(['skipFirefox', 'ml']); before(async () => { await ml.api.cleanMlIndices(); await ml.securityUI.loginAsMlPowerUser(); diff --git a/x-pack/test/functional/apps/ml/group3/settings/calendar_creation.ts b/x-pack/test/functional/apps/ml/short_tests/settings/calendar_creation.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/settings/calendar_creation.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/calendar_creation.ts diff --git a/x-pack/test/functional/apps/ml/group3/settings/calendar_delete.ts b/x-pack/test/functional/apps/ml/short_tests/settings/calendar_delete.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/settings/calendar_delete.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/calendar_delete.ts diff --git a/x-pack/test/functional/apps/ml/group3/settings/calendar_edit.ts b/x-pack/test/functional/apps/ml/short_tests/settings/calendar_edit.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/settings/calendar_edit.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/calendar_edit.ts diff --git a/x-pack/test/functional/apps/ml/group3/settings/common.ts b/x-pack/test/functional/apps/ml/short_tests/settings/common.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/settings/common.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/common.ts diff --git a/x-pack/test/functional/apps/ml/group3/settings/filter_list_creation.ts b/x-pack/test/functional/apps/ml/short_tests/settings/filter_list_creation.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/settings/filter_list_creation.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/filter_list_creation.ts diff --git a/x-pack/test/functional/apps/ml/group3/settings/filter_list_delete.ts b/x-pack/test/functional/apps/ml/short_tests/settings/filter_list_delete.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/settings/filter_list_delete.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/filter_list_delete.ts diff --git a/x-pack/test/functional/apps/ml/group3/settings/filter_list_edit.ts b/x-pack/test/functional/apps/ml/short_tests/settings/filter_list_edit.ts similarity index 100% rename from x-pack/test/functional/apps/ml/group3/settings/filter_list_edit.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/filter_list_edit.ts diff --git a/x-pack/test/functional/apps/ml/group3/settings/index.ts b/x-pack/test/functional/apps/ml/short_tests/settings/index.ts similarity index 95% rename from x-pack/test/functional/apps/ml/group3/settings/index.ts rename to x-pack/test/functional/apps/ml/short_tests/settings/index.ts index 9ac25b7fc9483b..d3f7000918a8e5 100644 --- a/x-pack/test/functional/apps/ml/group3/settings/index.ts +++ b/x-pack/test/functional/apps/ml/short_tests/settings/index.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('settings', function () { - this.tags(['mlqa', 'skipFirefox']); + this.tags(['ml', 'skipFirefox']); loadTestFile(require.resolve('./calendar_creation')); loadTestFile(require.resolve('./calendar_edit')); diff --git a/x-pack/test/functional/apps/ml/stack_management_jobs/config.ts b/x-pack/test/functional/apps/ml/stack_management_jobs/config.ts new file mode 100644 index 00000000000000..9d0fe82b9158c1 --- /dev/null +++ b/x-pack/test/functional/apps/ml/stack_management_jobs/config.ts @@ -0,0 +1,20 @@ +/* + * 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 { FtrConfigProviderContext } from '@kbn/test'; + +export default async function ({ readConfigFile }: FtrConfigProviderContext) { + const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js')); + + return { + ...functionalConfig.getAll(), + testFiles: [require.resolve('.')], + junit: { + reportName: 'Chrome X-Pack UI Functional Tests - ML stack_management_jobs', + }, + }; +} diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/export_jobs.ts b/x-pack/test/functional/apps/ml/stack_management_jobs/export_jobs.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group3/stack_management_jobs/export_jobs.ts rename to x-pack/test/functional/apps/ml/stack_management_jobs/export_jobs.ts index 4ced89e35d6088..c43cf74e3048c8 100644 --- a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/export_jobs.ts +++ b/x-pack/test/functional/apps/ml/stack_management_jobs/export_jobs.ts @@ -7,7 +7,7 @@ import { Job, Datafeed } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; import type { DataFrameAnalyticsConfig } from '@kbn/ml-plugin/public/application/data_frame_analytics/common'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; const testADJobs: Array<{ job: Job; datafeed: Datafeed }> = [ { @@ -255,7 +255,7 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); describe('export jobs', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await ml.api.cleanMlIndices(); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/files_to_import/anomaly_detection_jobs_7.16.json b/x-pack/test/functional/apps/ml/stack_management_jobs/files_to_import/anomaly_detection_jobs_7.16.json similarity index 100% rename from x-pack/test/functional/apps/ml/group3/stack_management_jobs/files_to_import/anomaly_detection_jobs_7.16.json rename to x-pack/test/functional/apps/ml/stack_management_jobs/files_to_import/anomaly_detection_jobs_7.16.json diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/files_to_import/bad_data.json b/x-pack/test/functional/apps/ml/stack_management_jobs/files_to_import/bad_data.json similarity index 100% rename from x-pack/test/functional/apps/ml/group3/stack_management_jobs/files_to_import/bad_data.json rename to x-pack/test/functional/apps/ml/stack_management_jobs/files_to_import/bad_data.json diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/files_to_import/data_frame_analytics_jobs_7.16.json b/x-pack/test/functional/apps/ml/stack_management_jobs/files_to_import/data_frame_analytics_jobs_7.16.json similarity index 100% rename from x-pack/test/functional/apps/ml/group3/stack_management_jobs/files_to_import/data_frame_analytics_jobs_7.16.json rename to x-pack/test/functional/apps/ml/stack_management_jobs/files_to_import/data_frame_analytics_jobs_7.16.json diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/import_jobs.ts b/x-pack/test/functional/apps/ml/stack_management_jobs/import_jobs.ts similarity index 97% rename from x-pack/test/functional/apps/ml/group3/stack_management_jobs/import_jobs.ts rename to x-pack/test/functional/apps/ml/stack_management_jobs/import_jobs.ts index 212bb029b6e0bb..e2ba704f5e1093 100644 --- a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/import_jobs.ts +++ b/x-pack/test/functional/apps/ml/stack_management_jobs/import_jobs.ts @@ -6,7 +6,7 @@ */ import { JobType } from '@kbn/ml-plugin/common/types/saved_objects'; -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -31,7 +31,7 @@ export default function ({ getService }: FtrProviderContext) { ]; describe('import jobs', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await ml.api.cleanMlIndices(); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); diff --git a/x-pack/test/functional/apps/ml/group2/index.ts b/x-pack/test/functional/apps/ml/stack_management_jobs/index.ts similarity index 69% rename from x-pack/test/functional/apps/ml/group2/index.ts rename to x-pack/test/functional/apps/ml/stack_management_jobs/index.ts index 4515715327e055..37f238dbeecc90 100644 --- a/x-pack/test/functional/apps/ml/group2/index.ts +++ b/x-pack/test/functional/apps/ml/stack_management_jobs/index.ts @@ -11,7 +11,8 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); - describe('machine learning - group 2', () => { + describe('machine learning - stack management jobs', function () { + this.tags(['ml', 'skipFirefox']); before(async () => { await ml.securityCommon.createMlRoles(); await ml.securityCommon.createMlUsers(); @@ -25,18 +26,16 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { await ml.securityCommon.cleanMlRoles(); await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/ecommerce'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/categorization_small'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/event_rate_nanos'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/bm_classification'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/ihp_outlier'); await esArchiver.unload('x-pack/test/functional/es_archives/ml/egs_regression'); - await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_sample_ecommerce'); await ml.testResources.resetKibanaTimeZone(); }); - loadTestFile(require.resolve('./anomaly_detection')); + loadTestFile(require.resolve('./synchronize')); + loadTestFile(require.resolve('./manage_spaces')); + loadTestFile(require.resolve('./import_jobs')); + loadTestFile(require.resolve('./export_jobs')); }); } diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/manage_spaces.ts b/x-pack/test/functional/apps/ml/stack_management_jobs/manage_spaces.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group3/stack_management_jobs/manage_spaces.ts rename to x-pack/test/functional/apps/ml/stack_management_jobs/manage_spaces.ts index 5563bb9043c7f6..e68502f4dab5ab 100644 --- a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/manage_spaces.ts +++ b/x-pack/test/functional/apps/ml/stack_management_jobs/manage_spaces.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const browser = getService('browser'); @@ -107,7 +107,7 @@ export default function ({ getService }: FtrProviderContext) { } describe('manage spaces', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ihp_outlier'); diff --git a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/synchronize.ts b/x-pack/test/functional/apps/ml/stack_management_jobs/synchronize.ts similarity index 98% rename from x-pack/test/functional/apps/ml/group3/stack_management_jobs/synchronize.ts rename to x-pack/test/functional/apps/ml/stack_management_jobs/synchronize.ts index e760549b7a1516..317a71ae79a0bd 100644 --- a/x-pack/test/functional/apps/ml/group3/stack_management_jobs/synchronize.ts +++ b/x-pack/test/functional/apps/ml/stack_management_jobs/synchronize.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { FtrProviderContext } from '../../../../ftr_provider_context'; +import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -20,7 +20,7 @@ export default function ({ getService }: FtrProviderContext) { const dfaJobIdES = 'ihp_od_es'; describe('synchronize', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ihp_outlier'); diff --git a/x-pack/test/functional/apps/transform/config.ts b/x-pack/test/functional/apps/transform/config.ts index d0d07ff2002816..17a471848867e6 100644 --- a/x-pack/test/functional/apps/transform/config.ts +++ b/x-pack/test/functional/apps/transform/config.ts @@ -13,5 +13,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...functionalConfig.getAll(), testFiles: [require.resolve('.')], + junit: { + reportName: 'Chrome X-Pack UI Functional Tests - Transform', + }, }; } diff --git a/x-pack/test/functional/services/cases/common.ts b/x-pack/test/functional/services/cases/common.ts index 7722c32f798373..5ba0c4dbbaa57b 100644 --- a/x-pack/test/functional/services/cases/common.ts +++ b/x-pack/test/functional/services/cases/common.ts @@ -7,12 +7,14 @@ import expect from '@kbn/expect'; import { CaseStatuses } from '@kbn/cases-plugin/common'; +import { CaseSeverity } from '@kbn/cases-plugin/common/api'; import { FtrProviderContext } from '../../ftr_provider_context'; export function CasesCommonServiceProvider({ getService, getPageObject }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const find = getService('find'); const header = getPageObject('header'); + const common = getPageObject('common'); return { /** @@ -58,5 +60,13 @@ export function CasesCommonServiceProvider({ getService, getPageObject }: FtrPro await label.click(); await this.assertRadioGroupValue(testSubject, value); }, + + async selectSeverity(severity: CaseSeverity) { + await common.clickAndValidate( + 'case-severity-selection', + `case-severity-selection-${severity}` + ); + await testSubjects.click(`case-severity-selection-${severity}`); + }, }; } diff --git a/x-pack/test/functional/services/cases/create.ts b/x-pack/test/functional/services/cases/create.ts index 5ed22ad51ad9f4..536badeee56a64 100644 --- a/x-pack/test/functional/services/cases/create.ts +++ b/x-pack/test/functional/services/cases/create.ts @@ -5,10 +5,12 @@ * 2.0. */ +import { CaseSeverity } from '@kbn/cases-plugin/common/api'; import uuid from 'uuid'; import { FtrProviderContext } from '../../ftr_provider_context'; export function CasesCreateViewServiceProvider({ getService, getPageObject }: FtrProviderContext) { + const common = getPageObject('common'); const testSubjects = getService('testSubjects'); const find = getService('find'); const comboBox = getService('comboBox'); @@ -39,10 +41,12 @@ export function CasesCreateViewServiceProvider({ getService, getPageObject }: Ft title = 'test-' + uuid.v4(), description = 'desc' + uuid.v4(), tag = 'tagme', + severity = CaseSeverity.LOW, }: { title: string; description: string; tag: string; + severity: CaseSeverity; }) { // case name await testSubjects.setValue('input', title); @@ -54,6 +58,11 @@ export function CasesCreateViewServiceProvider({ getService, getPageObject }: Ft const descriptionArea = await find.byCssSelector('textarea.euiMarkdownEditorTextArea'); await descriptionArea.focus(); await descriptionArea.type(description); + await common.clickAndValidate( + 'case-severity-selection', + `case-severity-selection-${severity}` + ); + await testSubjects.click(`case-severity-selection-${severity}`); // save await testSubjects.click('create-case-submit'); diff --git a/x-pack/test/functional/services/cases/list.ts b/x-pack/test/functional/services/cases/list.ts index 651f52434e55f7..f4d7103db0a619 100644 --- a/x-pack/test/functional/services/cases/list.ts +++ b/x-pack/test/functional/services/cases/list.ts @@ -7,6 +7,7 @@ import expect from '@kbn/expect'; import { CaseStatuses } from '@kbn/cases-plugin/common'; +import { CaseSeverityWithAll } from '@kbn/cases-plugin/common/ui'; import { WebElementWrapper } from '../../../../../test/functional/services/lib/web_element_wrapper'; import { FtrProviderContext } from '../../ftr_provider_context'; @@ -126,6 +127,11 @@ export function CasesTableServiceProvider({ getService, getPageObject }: FtrProv await testSubjects.click(`case-status-filter-${status}`); }, + async filterBySeverity(severity: CaseSeverityWithAll) { + await common.clickAndValidate('case-severity-filter', `case-severity-filter-${severity}`); + await testSubjects.click(`case-severity-filter-${severity}`); + }, + async filterByReporter(reporter: string) { await common.clickAndValidate( 'options-filter-popover-button-Reporter', diff --git a/x-pack/test/functional_basic/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts b/x-pack/test/functional_basic/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts index a2a135b8cef0cd..2fcdf957f8909d 100644 --- a/x-pack/test/functional_basic/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts +++ b/x-pack/test/functional_basic/apps/ml/data_visualizer/index_data_visualizer_actions_panel.ts @@ -12,7 +12,7 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); describe('index based actions panel on basic license', function () { - this.tags(['mlqa']); + this.tags(['ml']); const indexPatternName = 'ft_farequote'; const savedSearch = 'ft_farequote_kuery'; diff --git a/x-pack/test/functional_basic/apps/ml/index.ts b/x-pack/test/functional_basic/apps/ml/index.ts index 0188aa0361d942..dbdab2cc0a4b24 100644 --- a/x-pack/test/functional_basic/apps/ml/index.ts +++ b/x-pack/test/functional_basic/apps/ml/index.ts @@ -12,7 +12,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const ml = getService('ml'); describe('machine learning basic license', function () { - this.tags(['skipFirefox', 'mlqa']); + this.tags(['skipFirefox', 'ml']); before(async () => { await ml.securityCommon.createMlRoles(); diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/create_case_form.ts b/x-pack/test/functional_with_es_ssl/apps/cases/create_case_form.ts index c5aed361aba3ec..c4a7fad8224eae 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/create_case_form.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/create_case_form.ts @@ -7,6 +7,7 @@ import expect from '@kbn/expect'; import uuid from 'uuid'; +import { CaseSeverity } from '@kbn/cases-plugin/common/api'; import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getService }: FtrProviderContext) => { @@ -30,6 +31,7 @@ export default ({ getService }: FtrProviderContext) => { title: caseTitle, description: 'test description', tag: 'tagme', + severity: CaseSeverity.HIGH, }); // validate title diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/list_view.ts b/x-pack/test/functional_with_es_ssl/apps/cases/list_view.ts index c64f1514b7c45c..b05763cfcf0794 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/list_view.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/list_view.ts @@ -7,6 +7,8 @@ import expect from '@kbn/expect'; import { CaseStatuses } from '@kbn/cases-plugin/common'; +import { CaseSeverity } from '@kbn/cases-plugin/common/api'; +import { SeverityAll } from '@kbn/cases-plugin/common/ui'; import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getPageObject, getService }: FtrProviderContext) => { @@ -143,6 +145,51 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { }); }); + describe('severity filtering', () => { + before(async () => { + await cases.api.createCase({ severity: CaseSeverity.LOW }); + await cases.api.createCase({ severity: CaseSeverity.LOW }); + await cases.api.createCase({ severity: CaseSeverity.HIGH }); + await cases.api.createCase({ severity: CaseSeverity.HIGH }); + await cases.api.createCase({ severity: CaseSeverity.CRITICAL }); + await header.waitUntilLoadingHasFinished(); + await cases.casesTable.waitForCasesToBeListed(); + }); + beforeEach(async () => { + /** + * There is no easy way to clear the filtering. + * Refreshing the page seems to be easier. + */ + await cases.navigation.navigateToApp(); + }); + + after(async () => { + await cases.api.deleteAllCases(); + await cases.casesTable.waitForCasesToBeDeleted(); + }); + + it('filters cases by severity', async () => { + // by default filter by all + await cases.casesTable.validateCasesTableHasNthRows(5); + + // low + await cases.casesTable.filterBySeverity(CaseSeverity.LOW); + await cases.casesTable.validateCasesTableHasNthRows(2); + + // high + await cases.casesTable.filterBySeverity(CaseSeverity.HIGH); + await cases.casesTable.validateCasesTableHasNthRows(2); + + // critical + await cases.casesTable.filterBySeverity(CaseSeverity.CRITICAL); + await cases.casesTable.validateCasesTableHasNthRows(1); + + // back to all + await cases.casesTable.filterBySeverity(SeverityAll); + await cases.casesTable.validateCasesTableHasNthRows(5); + }); + }); + describe('pagination', () => { before(async () => { await cases.api.createNthRandomCases(8); diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/view_case.ts b/x-pack/test/functional_with_es_ssl/apps/cases/view_case.ts index a175e10fb7d185..9aaf523de6638d 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/view_case.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/view_case.ts @@ -8,6 +8,7 @@ import expect from '@kbn/expect'; import uuid from 'uuid'; import { CaseStatuses } from '@kbn/cases-plugin/common'; +import { CaseSeverity } from '@kbn/cases-plugin/common/api'; import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getPageObject, getService }: FtrProviderContext) => { @@ -184,9 +185,35 @@ export default ({ getPageObject, getService }: FtrProviderContext) => { await common.clickAndValidate('property-actions-ellipses', 'property-actions-trash'); await common.clickAndValidate('property-actions-trash', 'confirmModalConfirmButton'); await testSubjects.click('confirmModalConfirmButton'); - await testSubjects.existOrFail('cases-all-title', { timeout: 2000 }); + await header.waitUntilLoadingHasFinished(); await cases.casesTable.validateCasesTableHasNthRows(0); }); }); + + describe('Severity field', () => { + before(async () => { + await cases.navigation.navigateToApp(); + await cases.api.createNthRandomCases(1); + await cases.casesTable.waitForCasesToBeListed(); + await cases.casesTable.goToFirstListedCase(); + await header.waitUntilLoadingHasFinished(); + }); + + after(async () => { + await cases.api.deleteAllCases(); + }); + + it('shows the severity field on the sidebar', async () => { + await testSubjects.existOrFail('case-severity-selection'); + }); + it('changes the severity level from the selector', async () => { + await cases.common.selectSeverity(CaseSeverity.MEDIUM); + await header.waitUntilLoadingHasFinished(); + await testSubjects.existOrFail('case-severity-selection-' + CaseSeverity.MEDIUM); + + // validate user action + await find.byCssSelector('[data-test-subj*="severity-update-action"]'); + }); + }); }); }; diff --git a/x-pack/test/functional_with_es_ssl/apps/ml/index.ts b/x-pack/test/functional_with_es_ssl/apps/ml/index.ts index fac9e46dcb65bc..942416c73b357e 100644 --- a/x-pack/test/functional_with_es_ssl/apps/ml/index.ts +++ b/x-pack/test/functional_with_es_ssl/apps/ml/index.ts @@ -12,7 +12,7 @@ export default ({ loadTestFile, getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); describe('ML app', function () { - this.tags(['mlqa', 'skipFirefox']); + this.tags(['ml', 'skipFirefox']); before(async () => { await ml.securityCommon.createMlRoles(); diff --git a/x-pack/test/screenshot_creation/apps/ml_docs/index.ts b/x-pack/test/screenshot_creation/apps/ml_docs/index.ts index 9a121536826180..82460db174add2 100644 --- a/x-pack/test/screenshot_creation/apps/ml_docs/index.ts +++ b/x-pack/test/screenshot_creation/apps/ml_docs/index.ts @@ -16,7 +16,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { const ml = getService('ml'); describe('machine learning docs', function () { - this.tags(['mlqa']); + this.tags(['ml']); before(async () => { await ml.testResources.installAllKibanaSampleData();