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

[7.x] [APM] Use 7.x compatible archive for API tests (#107367) #107509

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file not shown.
6,803 changes: 3,256 additions & 3,547 deletions x-pack/plugins/apm/ftr_e2e/cypress/fixtures/es_archiver/apm_8.0.0/mappings.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* 2.0.
*/

/* eslint-disable import/no-default-export*/
export default {
/* eslint-disable-next-line*/
export default {
'apm_8.0.0': {
start: '2020-12-08T13:57:56.135Z',
end: '2020-12-08T14:27:56.135Z',
start: '2021-08-03T06:50:15.910Z',
end: '2021-08-03T07:20:15.910Z',
},
};
48 changes: 21 additions & 27 deletions x-pack/plugins/apm/scripts/create-functional-tests-archive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ async function run() {
bool: {
must_not: [
{
term: {
'service.name': 'elastic-co-frontend',
terms: {
'service.name': [
'elastic-co-frontend',
'filebeat',
'metricbeat',
'heartbeat',
'apm-server',
],
},
},
],
Expand Down Expand Up @@ -96,18 +102,6 @@ async function run() {
],
},
},
{
index: '.kibana',
bool: {
filter: [
{
term: {
type: 'ml-job',
},
},
],
},
},
];

// eslint-disable-next-line no-console
Expand Down Expand Up @@ -153,15 +147,15 @@ async function run() {
(bucket) => bucket.key as string
) ?? [];

const indicesToArchive = indicesWithDocs.join(',');

// create the archive
const tmpDir = path.join(__dirname, 'tmp/');
execSync(
`node scripts/es_archiver save ${archiveName} ${indicesWithDocs
.filter((index) => !index.startsWith('.kibana'))
.concat('.kibana')
.join(
','
)} --dir=${tmpDir} --kibana-url=${kibanaUrl} --es-url=${esUrl} --query='${JSON.stringify(
`node scripts/es_archiver save ${path.join(
tmpDir,
archiveName
)} ${indicesToArchive} --kibana-url=${kibanaUrl} --es-url=${esUrl} --query='${JSON.stringify(
query
)}'`,
{
Expand Down Expand Up @@ -192,17 +186,11 @@ async function run() {
fs.writeFileSync(
configFilePath,
`
/* eslint-disable import/no-default-export*/
/* eslint-disable-next-line*/
export default ${JSON.stringify(newConfig, null, 2)}`,
{ encoding: 'utf-8' }
);

// run ESLint on the generated metadata files
execSync('node scripts/eslint **/*/archives_metadata.ts --fix', {
cwd: root,
stdio: 'inherit',
});

const esArchiverDir = 'fixtures/es_archiver/';

const apiIntegrationDir = path.join(
Expand All @@ -220,6 +208,12 @@ async function run() {

// Delete tmp folder
execSync(`rm -rf ${tmpDir}`);

// run ESLint on the generated metadata files
execSync('node scripts/eslint x-pack/**/*/archives_metadata.ts --fix', {
cwd: root,
stdio: 'inherit',
});
}

run()
Expand Down
Binary file not shown.
Loading