Skip to content

Commit

Permalink
Revert "Revert: [7.x] [FTR][CI] Use default distribution for all tests (
Browse files Browse the repository at this point in the history
#102019) (#102580)

* Revert "Revert: [7.x] [FTR][CI] Use default distribution for all tests (#102019)"

This reverts commit c272bdb.

* [FTR] Stabilize SSLP functional tests (#102553)

* Removes spaces check, since spaces should always be available
* Disables Monitoring, SecuritySolutions, and Reporting in SSPL tests
until #102552 is completed

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Tyler Smalley and kibanamachine authored Jun 21, 2021
1 parent bd9feb9 commit 6977be0
Show file tree
Hide file tree
Showing 76 changed files with 2,507 additions and 4,926 deletions.
6 changes: 1 addition & 5 deletions .ci/Jenkinsfile_flaky
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ def agentProcess(Map params = [:]) {
]) {
task {
if (config.needBuild) {
if (!config.isXpack) {
kibanaPipeline.buildOss()
} else {
kibanaPipeline.buildXpack()
}
kibanaPipeline.buildKibana()
}

for(def i = 0; i < config.agentExecutions; i++) {
Expand Down
2 changes: 1 addition & 1 deletion .ci/Jenkinsfile_security_cypress
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ kibanaPipeline(timeoutMinutes: 180) {
def job = 'xpack-securityCypress'

workers.ci(name: job, size: 'l', ramDisk: true) {
kibanaPipeline.bash('test/scripts/jenkins_xpack_build_kibana.sh', 'Build Default Distributable')
kibanaPipeline.bash('test/scripts/jenkins_build_kibana.sh', 'Build Distributable')
kibanaPipeline.functionalTestProcess(job, 'test/scripts/jenkins_security_solution_cypress_chrome.sh')()
// Temporarily disabled to figure out test flake
// kibanaPipeline.functionalTestProcess(job, 'test/scripts/jenkins_security_solution_cypress_firefox.sh')()
Expand Down
6 changes: 1 addition & 5 deletions .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ kibanaPipeline(timeoutMinutes: 210) {
])

task {
kibanaPipeline.buildOss(6)
kibanaPipeline.buildKibana(16)
tasks.ossCiGroups()
}

task {
kibanaPipeline.buildXpack(10, true)
tasks.xpackCiGroups()
tasks.xpackCiGroupDocker()
}
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-es-archiver/src/actions/empty_kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ export async function emptyKibanaIndexAction({
kbnClient: KbnClient;
}) {
const stats = createStats('emptyKibanaIndex', log);
const kibanaPluginIds = await kbnClient.plugins.getEnabledIds();

await cleanKibanaIndices({ client, stats, log, kibanaPluginIds });
await cleanKibanaIndices({ client, stats, log });
await migrateKibanaIndex({ kbnClient });
stats.createdIndex('.kibana');
return stats.toJSON();
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-es-archiver/src/actions/unload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export async function unloadAction({
}) {
const name = relative(REPO_ROOT, inputDir);
const stats = createStats(name, log);
const kibanaPluginIds = await kbnClient.plugins.getEnabledIds();

const files = prioritizeMappings(await readDirectory(inputDir));
for (const filename of files) {
Expand All @@ -47,7 +46,7 @@ export async function unloadAction({
createReadStream(resolve(inputDir, filename)) as Readable,
...createParseArchiveStreams({ gzip: isGzip(filename) }),
createFilterRecordsStream('index'),
createDeleteIndexStream(client, stats, log, kibanaPluginIds),
createDeleteIndexStream(client, stats, log),
] as [Readable, ...Writable[]]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('esArchiver: createDeleteIndexStream()', () => {

await createPromiseFromStreams([
createListStream([createStubIndexRecord('index1')]),
createDeleteIndexStream(client, stats, log, []),
createDeleteIndexStream(client, stats, log),
]);

sinon.assert.notCalled(stats.deletedIndex as sinon.SinonSpy);
Expand All @@ -43,7 +43,7 @@ describe('esArchiver: createDeleteIndexStream()', () => {

await createPromiseFromStreams([
createListStream([createStubIndexRecord('index1')]),
createDeleteIndexStream(client, stats, log, []),
createDeleteIndexStream(client, stats, log),
]);

sinon.assert.calledOnce(stats.deletedIndex as sinon.SinonSpy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ import { Stats } from '../stats';
import { deleteIndex } from './delete_index';
import { cleanKibanaIndices } from './kibana_index';

export function createDeleteIndexStream(
client: KibanaClient,
stats: Stats,
log: ToolingLog,
kibanaPluginIds: string[]
) {
export function createDeleteIndexStream(client: KibanaClient, stats: Stats, log: ToolingLog) {
return new Transform({
readableObjectMode: true,
writableObjectMode: true,
Expand All @@ -29,7 +24,7 @@ export function createDeleteIndexStream(
const { index } = record.value;

if (index.startsWith('.kibana')) {
await cleanKibanaIndices({ client, stats, log, kibanaPluginIds });
await cleanKibanaIndices({ client, stats, log });
} else {
await deleteIndex({ client, stats, log, index });
}
Expand Down
11 changes: 1 addition & 10 deletions packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,11 @@ export async function cleanKibanaIndices({
client,
stats,
log,
kibanaPluginIds,
}: {
client: KibanaClient;
stats: Stats;
log: ToolingLog;
kibanaPluginIds: string[];
}) {
if (!kibanaPluginIds.includes('spaces')) {
return await deleteKibanaIndices({
client,
stats,
log,
});
}

while (true) {
const resp = await client.deleteByQuery(
{
Expand Down Expand Up @@ -168,6 +158,7 @@ export async function createDefaultSpace({
index,
type: '_doc',
id: 'space:default',
refresh: 'wait_for',
body: {
type: 'space',
updated_at: new Date().toISOString(),
Expand Down
11 changes: 7 additions & 4 deletions packages/kbn-test/src/kbn_client/kbn_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

import { ToolingLog } from '@kbn/dev-utils';

import { KbnClientRequester, ReqOptions } from './kbn_client_requester';
import { KbnClientStatus } from './kbn_client_status';
import { KbnClientImportExport } from './kbn_client_import_export';
import { KbnClientPlugins } from './kbn_client_plugins';
import { KbnClientVersion } from './kbn_client_version';
import { KbnClientRequester, ReqOptions } from './kbn_client_requester';
import { KbnClientSavedObjects } from './kbn_client_saved_objects';
import { KbnClientSpaces } from './kbn_client_spaces';
import { KbnClientStatus } from './kbn_client_status';
import { KbnClientUiSettings, UiSettingValues } from './kbn_client_ui_settings';
import { KbnClientImportExport } from './kbn_client_import_export';
import { KbnClientVersion } from './kbn_client_version';

export interface KbnClientOptions {
url: string;
Expand All @@ -29,6 +30,7 @@ export class KbnClient {
readonly plugins: KbnClientPlugins;
readonly version: KbnClientVersion;
readonly savedObjects: KbnClientSavedObjects;
readonly spaces: KbnClientSpaces;
readonly uiSettings: KbnClientUiSettings;
readonly importExport: KbnClientImportExport;

Expand Down Expand Up @@ -59,6 +61,7 @@ export class KbnClient {
this.plugins = new KbnClientPlugins(this.status);
this.version = new KbnClientVersion(this.status);
this.savedObjects = new KbnClientSavedObjects(this.log, this.requester);
this.spaces = new KbnClientSpaces(this.requester);
this.uiSettings = new KbnClientUiSettings(this.log, this.requester, this.uiSettingDefaults);
this.importExport = new KbnClientImportExport(
this.log,
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-test/src/kbn_client/kbn_client_requester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export class KbnClientRequester {
responseType: options.responseType,
// work around https://github.com/axios/axios/issues/2791
transformResponse: options.responseType === 'text' ? [(x) => x] : undefined,
maxContentLength: 30000000,
maxBodyLength: 30000000,
paramsSerializer: (params) => Qs.stringify(params),
});

Expand Down
67 changes: 67 additions & 0 deletions packages/kbn-test/src/kbn_client/kbn_client_spaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { KbnClientRequester, uriencode } from './kbn_client_requester';

interface UpdateBody {
name: string;
description?: string;
disabledFeatures?: string | string[];
initials?: string;
color?: string;
imageUrl?: string;
}

interface CreateBody extends UpdateBody {
id: string;
}

export class KbnClientSpaces {
constructor(private readonly requester: KbnClientRequester) {}

async create(body: CreateBody) {
await this.requester.request({
method: 'POST',
path: '/api/spaces/space',
body,
});
}

async update(id: string, body: UpdateBody) {
await this.requester.request({
method: 'PUT',
path: uriencode`/api/spaces/space/${id}`,
body,
});
}

async get(id: string) {
const { data } = await this.requester.request({
method: 'GET',
path: uriencode`/api/spaces/space/${id}`,
});

return data;
}

async list() {
const { data } = await this.requester.request({
method: 'GET',
path: '/api/spaces/space',
});

return data;
}

async delete(id: string) {
await this.requester.request({
method: 'DELETE',
path: uriencode`/api/spaces/space/${id}`,
});
}
}
4 changes: 1 addition & 3 deletions src/dev/precommit_hook/casing_check_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const IGNORE_FILE_GLOBS = [
'.ci/pipeline-library/**/*',
'packages/kbn-test/jest-preset.js',
'test/package/Vagrantfile',
'**/test/**/fixtures/**/*',

// filename must match language code which requires capital letters
'**/translations/*.json',
Expand All @@ -60,8 +61,6 @@ export const IGNORE_FILE_GLOBS = [
'x-pack/plugins/apm/e2e/**/*',

'x-pack/plugins/maps/server/fonts/**/*',
// packages for the ingest manager's api integration tests could be valid semver which has dashes
'x-pack/test/fleet_api_integration/apis/fixtures/test_packages/**/*',

// Bazel default files
'**/WORKSPACE.bazel',
Expand Down Expand Up @@ -97,7 +96,6 @@ export const IGNORE_DIRECTORY_GLOBS = [
...KEBAB_CASE_DIRECTORY_GLOBS,
'src/babel-*',
'packages/*',
'test/functional/fixtures/es_archiver/visualize_source-filters',
'packages/kbn-pm/src/utils/__fixtures__/*',
'x-pack/dev-tools',
'packages/kbn-optimizer/src/__fixtures__/mock_repo/x-pack',
Expand Down
2 changes: 2 additions & 0 deletions test/accessibility/apps/dashboard_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('dashboard panel full screen', async () => {
const header = await dashboardPanelActions.getPanelHeading('[Flights] Airline Carrier');
await dashboardPanelActions.toggleContextMenu(header);
await dashboardPanelActions.clickContextMenuMoreItem();

await testSubjects.click('embeddablePanelAction-togglePanel');
await a11y.testAppSnapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/home/sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function ({ getService }: FtrProviderContext) {

expect(resp.body).to.eql({
elasticsearchIndicesCreated: { kibana_sample_data_flights: 13059 },
kibanaSavedObjectsLoaded: 20,
kibanaSavedObjectsLoaded: 23,
});
});

Expand Down
14 changes: 11 additions & 3 deletions test/api_integration/apis/kql_telemetry/kql_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const es = getService('es');

describe('telemetry API', () => {
before(() => esArchiver.load('test/api_integration/fixtures/es_archiver/saved_objects/basic'));
after(() => esArchiver.unload('test/api_integration/fixtures/es_archiver/saved_objects/basic'));
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
);
});

it('should increment the opt *in* counter in the .kibana/kql-telemetry document', async () => {
await supertest
Expand Down
Loading

0 comments on commit 6977be0

Please sign in to comment.