Skip to content

Commit

Permalink
[functional tests] split security and spaces ftr configs (elastic#156350
Browse files Browse the repository at this point in the history
)

## Summary

Splitting ftr configs to speed up ftr tests run on CI 

```
The following "Functional Tests" configs have durations that exceed the maximum amount of time desired for a single CI job. 
This is not an error, and if you don't own any of these configs then you can ignore this warning.If you own any of these
configs please split them up ASAP and ask Operations if you have questions about how to do that.

x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts: 38.2 minutes
x-pack/test/spaces_api_integration/security_and_spaces/config_trial.ts: 38.2 minutes
```

After split:
x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts
20m 29s

x-pack/test/spaces_api_integration/security_and_spaces/copy_to_space_config_basic.ts
20m 52s
x-pack/test/spaces_api_integration/security_and_spaces/config_trial.ts
19m 57s

x-pack/test/spaces_api_integration/security_and_spaces/copy_to_space_config_trial.ts
21m 5s

Rebalancing it with other configs should speedup CI by at least few
minutes
  • Loading branch information
dmlemeshko authored May 3, 2023
1 parent 385d0dc commit 424eae3
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ enabled:
- x-pack/test/security_solution_endpoint/config.ts
- x-pack/test/session_view/basic/config.ts
- x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts
- x-pack/test/spaces_api_integration/security_and_spaces/copy_to_space_config_basic.ts
- x-pack/test/spaces_api_integration/security_and_spaces/config_trial.ts
- x-pack/test/spaces_api_integration/security_and_spaces/copy_to_space_config_trial.ts
- x-pack/test/spaces_api_integration/spaces_only/config.ts
- x-pack/test/timeline/security_and_spaces/config_trial.ts
- x-pack/test/ui_capabilities/security_and_spaces/config.ts
Expand Down
5 changes: 3 additions & 2 deletions x-pack/test/spaces_api_integration/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import { FtrConfigProviderContext } from '@kbn/test';
interface CreateTestConfigOptions {
license: string;
disabledPlugins?: string[];
testFiles?: string[];
}

export function createTestConfig(name: string, options: CreateTestConfigOptions) {
const { license, disabledPlugins = [] } = options;
const { license, disabledPlugins = [], testFiles } = options;

return async ({ readConfigFile }: FtrConfigProviderContext) => {
const config = {
Expand All @@ -32,7 +33,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
};

return {
testFiles: [require.resolve(`../${name}/apis/`)],
testFiles: testFiles ?? [require.resolve(`../${name}/apis/`)],
servers: config.xpack.api.get('servers'),
services: {
es: config.kibana.api.get('services.es'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* 2.0.
*/

import { AUTHENTICATION } from '../../common/lib/authentication';
import { SPACES } from '../../common/lib/spaces';
import { copyToSpaceTestSuiteFactory } from '../../common/suites/copy_to_space';
import { FtrProviderContext } from '../../common/ftr_provider_context';
import { AUTHENTICATION } from '../../../common/lib/authentication';
import { SPACES } from '../../../common/lib/spaces';
import { copyToSpaceTestSuiteFactory } from '../../../common/suites/copy_to_space';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function copyToSpaceSpacesAndSecuritySuite(context: FtrProviderContext) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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 { createUsersAndRoles } from '../../../common/lib/create_users_and_roles';
import { FtrProviderContext } from '../../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
export default function ({ loadTestFile, getService }: FtrProviderContext) {
const es = getService('es');
const supertest = getService('supertest');

describe('copy to space with security', function () {
before(async () => {
await createUsersAndRoles(es, supertest);
});

loadTestFile(require.resolve('./copy_to_space')); // ~ 19m 20s
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export default function ({ loadTestFile, getService }: FtrProviderContext) {
await createUsersAndRoles(es, supertest);
});

loadTestFile(require.resolve('./copy_to_space'));
loadTestFile(require.resolve('./resolve_copy_to_space_conflicts'));
loadTestFile(require.resolve('./create'));
loadTestFile(require.resolve('./delete'));
loadTestFile(require.resolve('./get_all'));
loadTestFile(require.resolve('./get_shareable_references'));
loadTestFile(require.resolve('./get'));
loadTestFile(require.resolve('./update'));
loadTestFile(require.resolve('./update_objects_spaces'));
loadTestFile(require.resolve('./disable_legacy_url_aliases'));
// total runtime ~ 17m
loadTestFile(require.resolve('./resolve_copy_to_space_conflicts')); // ~ 10m
loadTestFile(require.resolve('./create')); // ~ 2m
loadTestFile(require.resolve('./delete')); // ~ 1m 20s
loadTestFile(require.resolve('./get_all')); // ~ 50s
loadTestFile(require.resolve('./get_shareable_references')); // ~ 30s
loadTestFile(require.resolve('./get')); // ~ 30s
loadTestFile(require.resolve('./update')); // ~ 30s
loadTestFile(require.resolve('./update_objects_spaces')); // ~ 1m
loadTestFile(require.resolve('./disable_legacy_url_aliases')); // ~ 30s
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { createTestConfig } from '../common/config';

// eslint-disable-next-line import/no-default-export
export default createTestConfig('security_and_spaces', {
license: 'basic',
testFiles: [require.resolve('./apis/copy_to_space')],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { createTestConfig } from '../common/config';

// eslint-disable-next-line import/no-default-export
export default createTestConfig('security_and_spaces', {
license: 'trial',
testFiles: [require.resolve('./apis/copy_to_space')],
});

0 comments on commit 424eae3

Please sign in to comment.