mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[QA] Fixup flaky test (#156373)
## Summary Resolves https://github.com/elastic/kibana/issues/136856 - Add async keyword where it should have been. - Split archive into kbn and es archives... instigated by Pierre's comment: https://github.com/elastic/kibana/issues/136856#issuecomment-1253609280 - Note: Had to use both archive types as one archive is "hidden", and cannot be accessed via the kbn client. - Unload via Pierre's "new" clean method. - Add shell fn to print out server's currently loaded so's, with user and pass hardcoded for local dev.
This commit is contained in:
parent
6df32fd23b
commit
d1feb43722
10 changed files with 138 additions and 85 deletions
|
@ -19,12 +19,11 @@
|
|||
|
||||
standard_list="url,index-pattern,query,graph-workspace,tag,visualization,canvas-element,canvas-workpad,dashboard,search,lens,map,cases,uptime-dynamic-settings,osquery-saved-query,osquery-pack,infrastructure-ui-source,metrics-explorer-view,inventory-view,infrastructure-monitoring-log-view,apm-indices"
|
||||
|
||||
orig_archive="x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space"
|
||||
new_archive="x-pack/test/functional/fixtures/kbn_archiver/security_solution/timelines/7.15.0_space"
|
||||
orig_archive="test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects"
|
||||
new_archive="x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects"
|
||||
testFiles=("test/plugin_functional/test_suites/saved_objects_management/scroll_count.ts")
|
||||
|
||||
testFiles=("x-pack/test/api_integration/apis/security_solution/timeline_migrations.ts")
|
||||
|
||||
test_config="x-pack/test/api_integration/config.ts"
|
||||
test_config="test/plugin_functional/config.ts"
|
||||
|
||||
list_stragglers() {
|
||||
|
||||
|
@ -387,13 +386,27 @@ load_kbn() {
|
|||
local space=${1:-default}
|
||||
local archive=${2:-${new_archive}}
|
||||
|
||||
set -x
|
||||
node scripts/kbn_archiver.js --config "$test_config" load "$archive" --space "$space"
|
||||
set +x
|
||||
}
|
||||
|
||||
load_kbn_list() {
|
||||
local space=${1:-default}
|
||||
local archive=${2:-${new_archive}}
|
||||
local newArchives=("${:-${archive}}")
|
||||
|
||||
for x in "${newArchives[@]}"; do
|
||||
set -x
|
||||
node scripts/kbn_archiver.js --config "$test_config" load "$x" --space "$space"
|
||||
set +x
|
||||
load_kbn default "${x}"
|
||||
done
|
||||
}
|
||||
|
||||
print_so_types() {
|
||||
set -x
|
||||
node scripts/saved_objs_info.js --esUrl http://elastic:changeme@localhost:9220
|
||||
set +x
|
||||
}
|
||||
|
||||
load_created_kbn_archive() {
|
||||
set -x
|
||||
node scripts/kbn_archiver.js --config "$test_config" load "$new_archive"
|
||||
|
|
|
@ -1,22 +1,3 @@
|
|||
{
|
||||
"type": "doc",
|
||||
"value": {
|
||||
"id": "test-hidden-importable-exportable:ff3733a0-9fty-11e7-ahb3-3dcb94193fab",
|
||||
"index": ".kibana",
|
||||
"source": {
|
||||
"coreMigrationVersion": "7.14.0",
|
||||
"references": [
|
||||
],
|
||||
"test-hidden-importable-exportable": {
|
||||
"title": "Hidden Saved object type that is importable/exportable."
|
||||
},
|
||||
"type": "test-hidden-importable-exportable",
|
||||
"updated_at": "2021-02-11T18:51:23.794Z"
|
||||
},
|
||||
"type": "_doc"
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "doc",
|
||||
"value": {
|
||||
|
@ -34,4 +15,4 @@
|
|||
},
|
||||
"type": "_doc"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,18 +12,25 @@ import { PluginFunctionalProviderContext } from '../../services';
|
|||
export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
describe('delete', () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
before(async () => {
|
||||
await esArchiver.load(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
);
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects'
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
);
|
||||
await kibanaServer.savedObjects.clean({
|
||||
types: ['test-hidden-importable-exportable'],
|
||||
});
|
||||
});
|
||||
|
||||
it('should return generic 404 when trying to delete a doc with importableAndExportable types', async () =>
|
||||
await supertest
|
||||
|
|
|
@ -16,19 +16,25 @@ function ndjsonToObject(input: string): string[] {
|
|||
export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
describe('export', () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
before(async () => {
|
||||
await esArchiver.load(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
);
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects'
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
|
||||
);
|
||||
await kibanaServer.savedObjects.clean({
|
||||
types: ['test-hidden-importable-exportable'],
|
||||
});
|
||||
});
|
||||
it('exports objects with importableAndExportable types', async () =>
|
||||
await supertest
|
||||
.post('/api/saved_objects/_export')
|
||||
|
|
|
@ -12,18 +12,25 @@ import { PluginFunctionalProviderContext } from '../../services';
|
|||
export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
describe('find', () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
before(async () => {
|
||||
await esArchiver.load(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
);
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects'
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
);
|
||||
await kibanaServer.savedObjects.clean({
|
||||
types: ['test-hidden-importable-exportable'],
|
||||
});
|
||||
});
|
||||
|
||||
it('returns empty response for importableAndExportable types', async () =>
|
||||
await supertest
|
||||
|
|
|
@ -12,18 +12,25 @@ import { PluginFunctionalProviderContext } from '../../services';
|
|||
export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
describe('export', () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
before(async () => {
|
||||
await esArchiver.load(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
);
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects'
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
);
|
||||
await kibanaServer.savedObjects.clean({
|
||||
types: ['test-hidden-importable-exportable'],
|
||||
});
|
||||
});
|
||||
|
||||
it('resolves objects with importableAndExportable types', async () => {
|
||||
const fileBuffer = Buffer.from(
|
||||
|
|
|
@ -13,19 +13,26 @@ import type { PluginFunctionalProviderContext } from '../../services';
|
|||
export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
describe('_bulk_get', () => {
|
||||
describe('saved objects with hidden type', () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
before(async () => {
|
||||
await esArchiver.load(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
);
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects'
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
);
|
||||
await kibanaServer.savedObjects.clean({
|
||||
types: ['test-hidden-importable-exportable'],
|
||||
});
|
||||
});
|
||||
const URL = '/api/kibana/management/saved_objects/_bulk_get';
|
||||
const hiddenTypeExportableImportable = {
|
||||
type: 'test-hidden-importable-exportable',
|
||||
|
|
|
@ -12,19 +12,26 @@ import { PluginFunctionalProviderContext } from '../../services';
|
|||
export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
describe('find', () => {
|
||||
describe('saved objects with hidden type', () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
before(async () => {
|
||||
await esArchiver.load(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
);
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects'
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
);
|
||||
await kibanaServer.savedObjects.clean({
|
||||
types: ['test-hidden-importable-exportable'],
|
||||
});
|
||||
});
|
||||
it('returns saved objects with importableAndExportable types', async () =>
|
||||
await supertest
|
||||
.get('/api/kibana/management/saved_objects/_find?type=test-hidden-importable-exportable')
|
||||
|
|
|
@ -12,20 +12,27 @@ import { PluginFunctionalProviderContext } from '../../services';
|
|||
export default function ({ getService }: PluginFunctionalProviderContext) {
|
||||
const supertest = getService('supertest');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const apiUrl = '/api/kibana/management/saved_objects/scroll/counts';
|
||||
|
||||
describe('scroll_count', () => {
|
||||
describe('saved objects with hidden type', () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
before(async () => {
|
||||
await esArchiver.load(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
);
|
||||
await kibanaServer.importExport.load(
|
||||
'x-pack/test/functional/fixtures/kbn_archiver/saved_objects_management/hidden_saved_objects'
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload(
|
||||
'test/functional/fixtures/es_archiver/saved_objects_management/hidden_saved_objects'
|
||||
)
|
||||
);
|
||||
);
|
||||
await kibanaServer.savedObjects.clean({
|
||||
types: ['test-hidden-importable-exportable'],
|
||||
});
|
||||
});
|
||||
|
||||
it('only counts hidden types that are importableAndExportable', async () => {
|
||||
const res = await supertest
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"attributes": {
|
||||
"title": "Hidden Saved object type that is importable/exportable."
|
||||
},
|
||||
"coreMigrationVersion": "7.14.0",
|
||||
"id": "ff3733a0-9fty-11e7-ahb3-3dcb94193fab",
|
||||
"references": [],
|
||||
"type": "test-hidden-importable-exportable",
|
||||
"updated_at": "2021-02-11T18:51:23.794Z",
|
||||
"version": "WzIsMV0="
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue