Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Rollups CCS Test #144074

Merged
merged 33 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1605104
Removed comment of the issue that was referenced for the skip. But th…
cuff-links Sep 8, 2022
f74b2cc
Merge branch 'main' of github.com:elastic/kibana into main
cuff-links Sep 12, 2022
2417dec
Merge branch 'main' of github.com:elastic/kibana into main
cuff-links Sep 13, 2022
dcc34ae
Merge branch 'main' of github.com:elastic/kibana
Sep 14, 2022
965b476
Merge branch 'main' of github.com:elastic/kibana
cuff-links Sep 14, 2022
6a7bcff
Merge branch 'main' of github.com:elastic/kibana
Sep 15, 2022
9f4d356
Merge branch 'main' of github.com:cuff-links/kibana
Sep 15, 2022
77ac6f6
Merge branch 'main' of github.com:elastic/kibana
Sep 20, 2022
c32deee
Merge branch 'main' of github.com:elastic/kibana
cuff-links Sep 21, 2022
9d29832
Merge branch 'main' of github.com:elastic/kibana
Sep 21, 2022
b81531c
Merge branch 'main' of github.com:cuff-links/kibana
Sep 21, 2022
86b5eb3
Merge branch 'main' of github.com:elastic/kibana
cuff-links Sep 26, 2022
dd1f520
Merge branch 'main' of github.com:cuff-links/kibana
cuff-links Sep 26, 2022
7da9187
Merge branch 'main' of github.com:elastic/kibana
Sep 26, 2022
1f743d0
Merge branch 'main' of github.com:cuff-links/kibana
Sep 26, 2022
38680df
Merge branch 'main' of github.com:elastic/kibana
Sep 27, 2022
1cfb1d1
Merge branch 'main' of github.com:elastic/kibana
cuff-links Sep 28, 2022
af0fd4c
Merge branch 'main' of github.com:elastic/kibana
Sep 29, 2022
2eb4d72
Merge branch 'main' of github.com:cuff-links/kibana
Sep 29, 2022
9e7ac33
Merge branch 'main' of github.com:elastic/kibana
Oct 13, 2022
17b9e22
Unskipping test as a fix has been made. 138510
Oct 13, 2022
3ae07ee
Merge branch 'main' of github.com:elastic/kibana
Oct 18, 2022
be25f66
Merge branch 'main' of github.com:elastic/kibana
Oct 20, 2022
1898e87
Merge branch 'main' of github.com:elastic/kibana
Oct 20, 2022
39a868c
Made CCS test for rollups and made it conditional based on configurat…
Oct 26, 2022
37129bc
Merge branch 'main' of github.com:elastic/kibana into Ingest_Pipeline…
Oct 26, 2022
fa1ce1f
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Oct 27, 2022
1489f23
Fixed issues in build.
Oct 27, 2022
8af2c11
Fixed issues in build.
Oct 27, 2022
2d472df
Merge branch 'main' into Ingest_Pipelines_CCS_Test
Oct 27, 2022
af9ffb9
Merge branch 'main' into Ingest_Pipelines_CCS_Test
Oct 28, 2022
8ac6c92
Merge branch 'main' of github.com:elastic/kibana into Ingest_Pipeline…
cuff-links Oct 28, 2022
365b26c
Added comment to rollups test and using super user until the perms is…
cuff-links Oct 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/common/services/es_delete_all_indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import { FtrProviderContext } from '../ftr_provider_context';

export function EsDeleteAllIndicesProvider({ getService }: FtrProviderContext) {
const es = getService('es');
const log = getService('log');

async function deleteConcreteIndices(indices: string[]) {
async function deleteConcreteIndices(indices: string[], esNode: any) {
try {
await es.indices.delete({
await esNode.indices.delete({
index: indices,
ignore_unavailable: true,
});
Expand All @@ -23,15 +22,16 @@ export function EsDeleteAllIndicesProvider({ getService }: FtrProviderContext) {
}
}

return async (patterns: string | string[]) => {
return async (patterns: string | string[], remote: boolean = false) => {
const esNode = remote ? getService('remoteEs' as 'es') : getService('es');
for (const pattern of [patterns].flat()) {
for (let attempt = 1; ; attempt++) {
if (attempt > 5) {
throw new Error(`Failed to delete all indices with pattern [${pattern}]`);
}

// resolve pattern to concrete index names
const resp = await es.indices.getAlias(
const resp = await esNode.indices.getAlias(
{
index: pattern,
},
Expand All @@ -55,7 +55,7 @@ export function EsDeleteAllIndicesProvider({ getService }: FtrProviderContext) {
);

// delete the concrete indexes we found and try again until this pattern resolves to no indexes
await deleteConcreteIndices(indices);
await deleteConcreteIndices(indices, esNode);
}
}
};
Expand Down
9 changes: 6 additions & 3 deletions x-pack/test/functional/apps/rollup_job/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
* 2.0.
*/

export default function ({ loadTestFile }) {
export default function ({ loadTestFile, getService }) {
const config = getService('config');
describe('rollup app', function () {
loadTestFile(require.resolve('./rollup_jobs'));
loadTestFile(require.resolve('./hybrid_index_pattern'));
loadTestFile(require.resolve('./tsvb'));
if (!config.get('esTestCluster.ccs')) {
loadTestFile(require.resolve('./hybrid_index_pattern'));
loadTestFile(require.resolve('./tsvb'));
}
});
}
37 changes: 26 additions & 11 deletions x-pack/test/functional/apps/rollup_job/rollup_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,49 @@
import datemath from '@kbn/datemath';
import expect from '@kbn/expect';
import { mockIndices } from './hybrid_index_helper';
// import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }) {
const es = getService('es');
const config = getService('config');
const PageObjects = getPageObjects(['rollup', 'common', 'security']);
const security = getService('security');
const esDeleteAllIndices = getService('esDeleteAllIndices');
const kibanaServer = getService('kibanaServer');
const es = getService('es');
const isRunningCcs = config.get('esTestCluster.ccs') ? true : false;
let remoteEs;
if (isRunningCcs) {
remoteEs = getService('remoteEs');
}

describe('rollup job', function () {
//Since rollups can only be created once with the same name (even if you delete it),
//we add the Date.now() to avoid name collision.
// Since rollups can only be created once with the same name (even if you delete it),
// we add the Date.now() to avoid name collision.
const rollupJobName = 'rollup-to-be-' + Date.now();
const targetIndexName = 'rollup-to-be';
const rollupSourceIndexPattern = 'to-be*';
const indexPatternToUse = 'to-be*';
const rollupSourceIndexPattern = isRunningCcs
? 'ftr-remote:' + indexPatternToUse
: indexPatternToUse;
const rollupSourceDataPrepend = 'to-be';

//make sure all dates have the same concept of "now"
// make sure all dates have the same concept of "now"
const now = new Date();
const pastDates = [
datemath.parse('now-1d', { forceNow: now }),
datemath.parse('now-2d', { forceNow: now }),
datemath.parse('now-3d', { forceNow: now }),
];
before(async () => {
await security.testUser.setRoles(['manage_rollups_role']);
await security.testUser.setRoles(['manage_rollups_role', 'global_ccr_role', 'superuser']);
cuff-links marked this conversation as resolved.
Show resolved Hide resolved
await PageObjects.common.navigateToApp('rollupJob');
});

it('create new rollup job', async () => {
const interval = '1000ms';

const esNode = isRunningCcs ? remoteEs : es;
for (const day of pastDates) {
await es.index(mockIndices(day, rollupSourceDataPrepend));
await esNode.index(mockIndices(day, rollupSourceDataPrepend));
}

await PageObjects.rollup.createNewRollUpJob(
Expand All @@ -58,7 +68,7 @@ export default function ({ getService, getPageObjects }) {
});

after(async () => {
//Stop the running rollup job.
// Stop the running rollup job.
await es.transport.request({
path: `/_rollup/job/${rollupJobName}/_stop?wait_for_completion=true`,
method: 'POST',
Expand All @@ -69,8 +79,13 @@ export default function ({ getService, getPageObjects }) {
method: 'DELETE',
});

//Delete all data indices that were created.
await esDeleteAllIndices([targetIndexName, rollupSourceIndexPattern]);
// Delete all data indices that were created.
await esDeleteAllIndices([targetIndexName], false);
if (isRunningCcs) {
await esDeleteAllIndices([indexPatternToUse], true);
} else {
await esDeleteAllIndices([indexPatternToUse], false);
}
await kibanaServer.savedObjects.cleanStandardList();
await security.testUser.restoreDefaults();
});
Expand Down
6 changes: 5 additions & 1 deletion x-pack/test/functional/config.ccs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
return {
...functionalConfig.getAll(),

testFiles: [require.resolve('./apps/canvas'), require.resolve('./apps/lens/group1')],
testFiles: [
require.resolve('./apps/canvas'),
require.resolve('./apps/lens/group1'),
require.resolve('./apps/rollup_job'),
],

junit: {
reportName: 'X-Pack CCS Tests',
Expand Down