Skip to content

Commit

Permalink
Merge branch 'master' into ml-func-test
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Apr 6, 2020
2 parents 0997848 + ae9a751 commit bad171f
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .ci/Jenkinsfile_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ kibanaPipeline(timeoutMinutes: 180) {
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
]),
])
workers.base(name: 'coverage-worker', label: 'tests-l', ramDisk: false, bootstrapped: false) {
workers.base(name: 'coverage-worker', size: 'l', ramDisk: false, bootstrapped: false) {
kibanaPipeline.downloadCoverageArtifacts()
kibanaPipeline.bash(
'''
Expand Down
4 changes: 2 additions & 2 deletions .ci/Jenkinsfile_visual_baseline
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ kibanaPipeline(timeoutMinutes: 120) {
catchError {
parallel([
'oss-visualRegression': {
workers.ci(name: 'oss-visualRegression', label: 'linux && immutable', ramDisk: false) {
workers.ci(name: 'oss-visualRegression', size: 's', ramDisk: false) {
kibanaPipeline.functionalTestProcess('oss-visualRegression', './test/scripts/jenkins_visual_regression.sh')(1)
}
},
'xpack-visualRegression': {
workers.ci(name: 'xpack-visualRegression', label: 'linux && immutable', ramDisk: false) {
workers.ci(name: 'xpack-visualRegression', size: 's', ramDisk: false) {
kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh')(1)
}
},
Expand Down
2 changes: 1 addition & 1 deletion .ci/es-snapshots/Jenkinsfile_build_es
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def PROMOTE_WITHOUT_VERIFY = !!params.PROMOTE_WITHOUT_VERIFICATION
timeout(time: 120, unit: 'MINUTES') {
timestamps {
ansiColor('xterm') {
node('linux && immutable') {
node(workers.label('s')) {
catchErrors {
def VERSION
def SNAPSHOT_ID
Expand Down
2 changes: 1 addition & 1 deletion .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ kibanaPipeline(timeoutMinutes: 120) {
}

def promoteSnapshot(snapshotVersion, snapshotId) {
node('linux && immutable') {
node(workers.label('s')) {
esSnapshots.promote(snapshotVersion, snapshotId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function ContextAppRouteController($routeParams, $scope, $route) {
getFilters,
setFilters,
setAppState,
flushToUrl,
} = getState({
defaultStepSize: getServices().uiSettings.get('context:defaultSize'),
timeFieldName: indexPattern.timeFieldName,
Expand All @@ -99,6 +100,7 @@ function ContextAppRouteController($routeParams, $scope, $route) {
const [columns, predecessorCount, successorCount] = newValues;
if (Array.isArray(columns) && predecessorCount >= 0 && successorCount >= 0) {
setAppState({ columns, predecessorCount, successorCount });
flushToUrl(true);
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ interface GetStateReturn {
/**
* sync state to URL, used for testing
*/
flushToUrl: () => void;
flushToUrl: (replace?: boolean) => void;
}
const GLOBAL_STATE_URL_KEY = '_g';
const APP_STATE_URL_KEY = '_a';
Expand Down Expand Up @@ -205,7 +205,7 @@ export function getState({
}
},
// helper function just needed for testing
flushToUrl: () => stateStorage.flush(),
flushToUrl: (replace?: boolean) => stateStorage.flush({ replace }),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const useSendCurrentRequestToES = () => {
const requests = await editor.getRequestsInRange();
if (!requests.length) {
notifications.toasts.add(
i18n.translate('console.notification.noReqeustSelectedTitle', {
i18n.translate('console.notification.error.noRequestSelectedTitle', {
defaultMessage:
'No request selected. Select a request by placing the cursor inside it.',
})
Expand All @@ -55,7 +55,16 @@ export const useSendCurrentRequestToES = () => {
const results = await sendRequestToES({ requests });

results.forEach(({ request: { path, method, data } }) => {
history.addToHistory(path, method, data);
try {
history.addToHistory(path, method, data);
} catch (e) {
// Best effort, but notify the user.
notifications.toasts.addError(e, {
title: i18n.translate('console.notification.error.couldNotSaveRequestTitle', {
defaultMessage: 'Could not save request to history.',
}),
});
}
});

const { polling } = settings.toJSON();
Expand Down Expand Up @@ -85,7 +94,7 @@ export const useSendCurrentRequestToES = () => {
payload: undefined,
});
notifications.toasts.addError(e, {
title: i18n.translate('console.notification.unknownRequestErrorTitle', {
title: i18n.translate('console.notification.error.unknownErrorTitle', {
defaultMessage: 'Unknown Request Error',
}),
});
Expand Down
3 changes: 2 additions & 1 deletion test/accessibility/apps/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
// await PageObjects.common.navigateToApp('settings');
// });

describe('Management', () => {
// FLAKY: https://github.com/elastic/kibana/issues/60470
describe.skip('Management', () => {
before(async () => {
await esArchiver.load('discover');
await esArchiver.loadIfNeeded('logstash_functional');
Expand Down
61 changes: 61 additions & 0 deletions test/functional/apps/context/_context_navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import expect from '@kbn/expect';

const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [
['extension', 'jpg'],
['geo.src', 'IN'],
];

export default function({ getService, getPageObjects }) {
const browser = getService('browser');
const docTable = getService('docTable');
const PageObjects = getPageObjects(['common', 'context', 'discover', 'timePicker']);

describe('context link in discover', function contextSize() {
before(async function() {
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setDefaultAbsoluteRange();
await Promise.all(
TEST_COLUMN_NAMES.map(columnName => PageObjects.discover.clickFieldListItemAdd(columnName))
);
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItem(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
}
});

it('should go back after loading', async function() {
// navigate to the context view
await docTable.clickRowToggle({ rowIndex: 0 });
await (await docTable.getRowActions({ rowIndex: 0 }))[0].click();
await PageObjects.context.waitUntilContextLoadingHasFinished();
await PageObjects.context.clickSuccessorLoadMoreButton();
await PageObjects.context.clickSuccessorLoadMoreButton();
await PageObjects.context.clickSuccessorLoadMoreButton();
await PageObjects.context.waitUntilContextLoadingHasFinished();
await browser.goBack();
await PageObjects.discover.waitForDocTableLoadingComplete();
const hitCount = await PageObjects.discover.getHitCount();
expect(hitCount).to.be('1,556');
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/context/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default function({ getService, getPageObjects, loadTestFile }) {
return esArchiver.unload('logstash_functional');
});

loadTestFile(require.resolve('./_context_navigation'));
loadTestFile(require.resolve('./_discover_navigation'));
loadTestFile(require.resolve('./_filters'));
loadTestFile(require.resolve('./_size'));
Expand Down
9 changes: 4 additions & 5 deletions test/functional/apps/discover/_field_visualize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
defaultIndex: 'logstash-*',
};

// FLAKY: https://github.com/elastic/kibana/issues/61714
describe.skip('discover field visualize button', () => {
describe('discover field visualize button', () => {
before(async function() {
log.debug('load kibana index with default index pattern');
await esArchiver.load('discover');
Expand All @@ -50,7 +49,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should visualize a field in area chart', async () => {
await PageObjects.discover.clickFieldListItem('phpmemory');
await PageObjects.discover.findFieldByName('phpmemory');
log.debug('visualize a phpmemory field');
await PageObjects.discover.clickFieldListItemVisualize('phpmemory');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -83,7 +82,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {

it('should preserve app filters in visualize', async () => {
await filterBar.addFilter('bytes', 'is between', '3500', '4000');
await PageObjects.discover.clickFieldListItem('geo.src');
await PageObjects.discover.findFieldByName('geo.src');
log.debug('visualize a geo.src field with filter applied');
await PageObjects.discover.clickFieldListItemVisualize('geo.src');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down Expand Up @@ -119,7 +118,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
it('should preserve query in visualize', async () => {
await queryBar.setQuery('machine.os : ios');
await queryBar.submitQuery();
await PageObjects.discover.clickFieldListItem('geo.dest');
await PageObjects.discover.findFieldByName('geo.dest');
log.debug('visualize a geo.dest field with query applied');
await PageObjects.discover.clickFieldListItemVisualize('geo.dest');
await PageObjects.header.waitUntilLoadingHasFinished();
Expand Down
19 changes: 15 additions & 4 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
return await el.getVisibleText();
}

public async findFieldByName(name: string) {
const fieldSearch = await testSubjects.find('fieldFilterSearchInput');
await fieldSearch.type(name);
}

public async saveSearch(searchName: string) {
log.debug('saveSearch');
await this.clickSaveSearchButton();
Expand Down Expand Up @@ -239,10 +244,16 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
await testSubjects.click(`fieldToggle-${field}`);
}

public async clickFieldListItemVisualize(field: string) {
return await retry.try(async () => {
await testSubjects.click(`fieldVisualize-${field}`);
});
public async clickFieldListItemVisualize(fieldName: string) {
const field = await testSubjects.find(`field-${fieldName}-showDetails`);
const isActive = await field.elementHasClass('dscSidebarItem--active');

if (!isActive) {
// expand the field to show the "Visualize" button
await field.click();
}

await testSubjects.click(`fieldVisualize-${fieldName}`);
}

public async expectFieldListItemVisualize(field: string) {
Expand Down
35 changes: 25 additions & 10 deletions vars/workers.groovy
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
// "Workers" in this file will spin up an instance, do some setup etc depending on the configuration, and then execute some work that you define
// e.g. workers.base(name: 'my-worker') { sh "echo 'ready to execute some kibana scripts'" }

def label(size) {
switch(size) {
case 's':
return 'linux && immutable'
case 'l':
return 'tests-l'
case 'xl':
return 'tests-xl'
case 'xxl':
return 'tests-xxl'
}

error "unknown size '${size}'"
}

/*
The base worker that all of the others use. Will clone the scm (assumed to be kibana), and run kibana bootstrap processes by default.
Parameters:
label - gobld/agent label to use, e.g. 'linux && immutable'
size - size of worker label to use, e.g. 's' or 'xl'
ramDisk - Should the workspace be mounted in memory? Default: true
bootstrapped - If true, download kibana dependencies, run kbn bootstrap, etc. Default: true
name - Name of the worker for display purposes, filenames, etc.
scm - Jenkins scm configuration for checking out code. Use `null` to disable checkout. Default: inherited from job
*/
def base(Map params, Closure closure) {
def config = [label: '', ramDisk: true, bootstrapped: true, name: 'unnamed-worker', scm: scm] + params
if (!config.label) {
error "You must specify an agent label, such as 'tests-xl' or 'linux && immutable', when using workers.base()"
def config = [size: '', ramDisk: true, bootstrapped: true, name: 'unnamed-worker', scm: scm] + params
if (!config.size) {
error "You must specify an agent size, such as 'xl' or 's', when using workers.base()"
}

node(config.label) {
node(label(config.size)) {
agentInfo.print()

if (config.ramDisk) {
Expand Down Expand Up @@ -88,7 +103,7 @@ def ci(Map params, Closure closure) {
// Worker for running the current intake jobs. Just runs a single script after bootstrap.
def intake(jobName, String script) {
return {
ci(name: jobName, label: 'linux && immutable', ramDisk: false) {
ci(name: jobName, size: 's', ramDisk: false) {
withEnv(["JOB=${jobName}"]) {
runbld(script, "Execute ${jobName}")
}
Expand All @@ -99,7 +114,7 @@ def intake(jobName, String script) {
// Worker for running functional tests. Runs a setup process (e.g. the kibana build) then executes a map of closures in parallel (e.g. one for each ciGroup)
def functional(name, Closure setup, Map processes) {
return {
parallelProcesses(name: name, setup: setup, processes: processes, delayBetweenProcesses: 20, label: 'tests-xl')
parallelProcesses(name: name, setup: setup, processes: processes, delayBetweenProcesses: 20, size: 'xl')
}
}

Expand All @@ -111,12 +126,12 @@ def functional(name, Closure setup, Map processes) {
setup: Closure to execute after the agent is bootstrapped, before starting the parallel work
processes: Map of closures that will execute in parallel after setup. Each closure is passed a unique number.
delayBetweenProcesses: Number of seconds to wait between starting the parallel processes. Useful to spread the load of heavy init processes, e.g. Elasticsearch starting up. Default: 0
label: gobld/agent label to use, e.g. 'linux && immutable'. Default: 'tests-xl', a 32 CPU machine used for running many functional test suites in parallel
size: size of worker label to use, e.g. 's' or 'xl'
*/
def parallelProcesses(Map params) {
def config = [name: 'parallel-worker', setup: {}, processes: [:], delayBetweenProcesses: 0, label: 'tests-xl'] + params
def config = [name: 'parallel-worker', setup: {}, processes: [:], delayBetweenProcesses: 0, size: 'xl'] + params

ci(label: config.label, name: config.name) {
ci(size: config.size, name: config.name) {
config.setup()

def nextProcessNumber = 1
Expand Down
2 changes: 0 additions & 2 deletions x-pack/test/functional/apps/maps/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default function({ getService, getPageObjects }) {

it('should link geo_shape fields to Maps application', async () => {
await PageObjects.discover.selectIndexPattern('geo_shapes*');
await PageObjects.discover.clickFieldListItem('geometry');
await PageObjects.discover.clickFieldListItemVisualize('geometry');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
Expand All @@ -37,7 +36,6 @@ export default function({ getService, getPageObjects }) {
await queryBar.submitQuery();
await PageObjects.header.waitUntilLoadingHasFinished();

await PageObjects.discover.clickFieldListItem('geo.coordinates');
await PageObjects.discover.clickFieldListItemVisualize('geo.coordinates');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
Expand Down

0 comments on commit bad171f

Please sign in to comment.