[Archive Migrations] remove es_archiver/empty_kibana from Fleet api tests (#139505)

* remove use of empty_kibana es_archive

* remove empty_kibana archives again

* replace es_archiver/empty_kibana with cleanStandardList

* remove more empty_kibana uses

* add cleanup of a package

* remove comment

* add Fleet saved object types to cleanStandardList

Co-authored-by: Spencer <spencer@elastic.co>
This commit is contained in:
Lee Drengenberg 2022-09-01 12:57:46 -05:00 committed by GitHub
parent bd632f37b5
commit 892e6327d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 496 deletions

View file

@ -246,6 +246,14 @@ export class KbnClientSavedObjects {
'inventory-view',
'infrastructure-monitoring-log-view',
'apm-indices',
// Fleet saved object types
'ingest-outputs',
'ingest-download-sources',
'ingest-agent-policies',
'ingest-package-policies',
'epm-packages',
'epm-packages-assets',
'fleet-preconfiguration-deletion-record',
];
const newOptions = { types, space: options?.space };

View file

@ -1,243 +0,0 @@
{
"type": "index",
"value": {
"aliases": {
".kibana": {}
},
"index": ".kibana_1",
"mappings": {
"properties": {
"config": {
"dynamic": "true",
"properties": {
"buildNum": {
"type": "keyword"
},
"dateFormat:tz": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
},
"dashboard": {
"dynamic": "strict",
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"optionsJSON": {
"type": "text"
},
"panelsJSON": {
"type": "text"
},
"refreshInterval": {
"properties": {
"display": {
"type": "keyword"
},
"pause": {
"type": "boolean"
},
"section": {
"type": "integer"
},
"value": {
"type": "integer"
}
}
},
"timeFrom": {
"type": "keyword"
},
"timeRestore": {
"type": "boolean"
},
"timeTo": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"index-pattern": {
"dynamic": "strict",
"properties": {
"fieldFormatMap": {
"type": "text"
},
"fields": {
"type": "text"
},
"intervalName": {
"type": "keyword"
},
"notExpandable": {
"type": "boolean"
},
"sourceFilters": {
"type": "text"
},
"timeFieldName": {
"type": "keyword"
},
"title": {
"type": "text"
}
}
},
"search": {
"dynamic": "strict",
"properties": {
"columns": {
"type": "keyword"
},
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"sort": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"server": {
"dynamic": "strict",
"properties": {
"uuid": {
"type": "keyword"
}
}
},
"type": {
"type": "keyword"
},
"url": {
"dynamic": "strict",
"properties": {
"accessCount": {
"type": "long"
},
"accessDate": {
"type": "date"
},
"createDate": {
"type": "date"
},
"url": {
"fields": {
"keyword": {
"ignore_above": 2048,
"type": "keyword"
}
},
"type": "text"
}
}
},
"visualization": {
"dynamic": "strict",
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"savedSearchId": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
},
"visState": {
"type": "text"
}
}
},
"query": {
"properties": {
"title": {
"type": "text"
},
"description": {
"type": "text"
},
"query": {
"properties": {
"language": {
"type": "keyword"
},
"query": {
"type": "keyword",
"index": false
}
}
},
"filters": {
"type": "object",
"enabled": false
},
"timefilter": {
"type": "object",
"enabled": false
}
}
}
}
},
"settings": {
"index": {
"number_of_replicas": "1",
"number_of_shards": "1"
}
}
}
}

View file

@ -25,6 +25,10 @@ export default function (providerContext: FtrProviderContext) {
.send({ force: true });
};
const uninstallPackage = async (pkg: string, version: string) => {
await supertest.delete(`/api/fleet/epm/packages/${pkg}/${version}`).set('kbn-xsrf', 'xxxx');
};
const getPackageInfo = async (pkg: string, version: string) => {
return await supertest.get(`/api/fleet/epm/packages/${pkg}/${version}`).set('kbn-xsrf', 'xxxx');
};
@ -37,6 +41,7 @@ export default function (providerContext: FtrProviderContext) {
});
afterEach(async () => {
await kibanaServer.savedObjects.cleanStandardList();
await uninstallPackage(pkgName, goodPackageVersion);
});
it('on a fresh install, it should uninstall a broken package during rollback', async function () {

View file

@ -76,6 +76,7 @@ export default function (providerContext: FtrProviderContext) {
await uninstallPackages([
{ name: pkgName, version: pkgVersion },
{ name: experimentalPkgName, version: pkgVersion },
{ name: experimental2PkgName, version: pkgVersion },
]);
});
it('should create index patterns (without fields)', async () => {

View file

@ -14,16 +14,17 @@ export default function (providerContext: FtrProviderContext) {
const supertest = getService('supertest');
const es = getService('es');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
describe('fleet_setup', () => {
skipIfNoDockerRegistry(providerContext);
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.load('x-pack/test/functional/es_archives/fleet/empty_fleet_server');
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
await esArchiver.unload('x-pack/test/functional/es_archives/fleet/empty_fleet_server');
});
beforeEach(async () => {

View file

@ -11,6 +11,7 @@ import { skipIfNoDockerRegistry } from '../../helpers';
export default function (providerContext: FtrProviderContext) {
const { getService } = providerContext;
const supertest = getService('supertest');
const kibanaServer = getService('kibanaServer');
describe('Package Policy - delete', () => {
skipIfNoDockerRegistry(providerContext);
@ -18,7 +19,7 @@ export default function (providerContext: FtrProviderContext) {
let agentPolicy: any;
let packagePolicy: any;
before(async () => {
await getService('esArchiver').load('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
await getService('esArchiver').load(
'x-pack/test/functional/es_archives/fleet/empty_fleet_server'
);
@ -84,7 +85,7 @@ export default function (providerContext: FtrProviderContext) {
.send({ force: true, packagePolicyIds: [packagePolicy.id] });
});
after(async () => {
await getService('esArchiver').unload('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
await getService('esArchiver').unload(
'x-pack/test/functional/es_archives/fleet/empty_fleet_server'
);
@ -151,7 +152,7 @@ export default function (providerContext: FtrProviderContext) {
let agentPolicy: any;
let packagePolicy: any;
before(async () => {
await getService('esArchiver').load('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
await getService('esArchiver').load(
'x-pack/test/functional/es_archives/fleet/empty_fleet_server'
);
@ -215,7 +216,7 @@ export default function (providerContext: FtrProviderContext) {
.send({ force: true, packagePolicyIds: [packagePolicy.id] });
});
after(async () => {
await getService('esArchiver').unload('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
await getService('esArchiver').unload(
'x-pack/test/functional/es_archives/fleet/empty_fleet_server'
);

View file

@ -12,6 +12,7 @@ export default function (providerContext: FtrProviderContext) {
const { getService } = providerContext;
const supertest = getService('supertest');
const dockerServers = getService('dockerServers');
const kibanaServer = getService('kibanaServer');
const getPackagePolicyById = async (id: string) => {
const { body } = await supertest.get(`/api/fleet/package_policies/${id}`);
@ -30,7 +31,7 @@ export default function (providerContext: FtrProviderContext) {
let packagePolicyId: string;
let packagePolicyId2: string;
before(async () => {
await getService('esArchiver').load('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
await getService('esArchiver').load(
'x-pack/test/functional/es_archives/fleet/empty_fleet_server'
);
@ -119,7 +120,7 @@ export default function (providerContext: FtrProviderContext) {
await getService('esArchiver').unload(
'x-pack/test/functional/es_archives/fleet/empty_fleet_server'
);
await getService('esArchiver').unload('x-pack/test/functional/es_archives/empty_kibana');
await kibanaServer.savedObjects.cleanStandardList();
});
it('should work with valid values on "regular" policies', async function () {

View file

@ -1,245 +0,0 @@
{
"type": "index",
"value": {
"aliases": {
".kibana": {}
},
"index": ".kibana_1",
"mappings": {
"properties": {
"config": {
"dynamic": "true",
"properties": {
"buildNum": {
"type": "keyword"
},
"dateFormat:tz": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
},
"dashboard": {
"dynamic": "strict",
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"optionsJSON": {
"type": "text"
},
"panelsJSON": {
"type": "text"
},
"refreshInterval": {
"properties": {
"display": {
"type": "keyword"
},
"pause": {
"type": "boolean"
},
"section": {
"type": "integer"
},
"value": {
"type": "integer"
}
}
},
"timeFrom": {
"type": "keyword"
},
"timeRestore": {
"type": "boolean"
},
"timeTo": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"index-pattern": {
"dynamic": "strict",
"properties": {
"fieldFormatMap": {
"type": "text"
},
"fields": {
"type": "text"
},
"intervalName": {
"type": "keyword"
},
"notExpandable": {
"type": "boolean"
},
"sourceFilters": {
"type": "text"
},
"timeFieldName": {
"type": "keyword"
},
"title": {
"type": "text"
}
}
},
"search": {
"dynamic": "strict",
"properties": {
"columns": {
"type": "keyword"
},
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"sort": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"server": {
"dynamic": "strict",
"properties": {
"uuid": {
"type": "keyword"
}
}
},
"space": {
"properties": {
"_reserved": {
"type": "boolean"
},
"color": {
"type": "keyword"
},
"description": {
"type": "text"
},
"disabledFeatures": {
"type": "keyword"
},
"initials": {
"type": "keyword"
},
"name": {
"fields": {
"keyword": {
"ignore_above": 2048,
"type": "keyword"
}
},
"type": "text"
}
}
},
"spaceId": {
"type": "keyword"
},
"type": {
"type": "keyword"
},
"url": {
"dynamic": "strict",
"properties": {
"accessCount": {
"type": "long"
},
"accessDate": {
"type": "date"
},
"createDate": {
"type": "date"
},
"url": {
"fields": {
"keyword": {
"ignore_above": 2048,
"type": "keyword"
}
},
"type": "text"
}
}
},
"visualization": {
"dynamic": "strict",
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"savedSearchId": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
},
"visState": {
"type": "text"
}
}
}
}
},
"settings": {
"index": {
"number_of_replicas": "1",
"number_of_shards": "1"
}
}
}
}