[Archive Migrations] dashboard/feature_controls/spaces (#139342)

* [Archive Migrations] dashboard/feature_controls/spaces

Replaces the old es archive with kbn archive.
Change test to use new archive.

Helps with: https://github.com/elastic/kibana/issues/102552

* Whoops, forgot to drop the archive.
This commit is contained in:
Tre 2022-09-01 20:31:10 +01:00 committed by GitHub
parent 2c4f910bdf
commit 677390d0a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 147 additions and 594 deletions

View file

@ -1,12 +1,24 @@
#!/bin/bash
# ??? Should we migrate
# x-pack/test/functional/es_archives/dashboard/feature_controls/spaces
# ### Yes, it needs migration
# ### Saved Object type(s) that we care about:
# dashboard
# index-pattern
# visualization
# ### Test file(s) that use it:
# x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_spaces.ts
# ### Config(s) that govern the test file(s):
# x-pack/test/functional/apps/dashboard/group1/config.ts
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/dashboard/session_in_space"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space"
newArchives=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_space")
newArchives+=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/session_in_another_space")
test_config="x-pack/test/search_sessions_integration/config.ts"
orig_archive="x-pack/test/functional/es_archives/dashboard/feature_controls/spaces"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/dashboard/feature_controls/custom_space"
newArchives=("x-pack/test/functional/fixtures/kbn_archiver/dashboard/feature_controls/custom_space")
newArchives+=("x-pack/test/functional/fixtures/kbn_archiver/reporting/ecommerce_kibana_non_timezone_space")
test_config="x-pack/test/functional/apps/dashboard/group1/config.ts"
curl_so_count() {
local so=${1:-search-session}
@ -73,6 +85,11 @@ delete_space() {
--user elastic:changeme http://localhost:5620/api/spaces/space/"$id"
}
# Just a note that this is using Gnu date.
# On OSX if you don't install this, and instead use the native date you only get seconds.
# With gdate you can something like nanoseconds.
alias timestamp='while read line; do echo "[`gdate +%H:%M:%S.%N`] $line"; done'
arrayify_csv() {
local xs=${1}
echo "$xs" | tr ',' '\n' | uniq | sort
@ -339,29 +356,42 @@ save_kbn() {
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"
node scripts/kbn_archiver.js --config "$test_config" load "$new_archive" --space "$space"
set +x
}
load_kbns() {
local space=${1:-default}
for x in "${newArchives[@]}"; do
set -x
node scripts/kbn_archiver.js --config "$test_config" load "$x" --space "$space"
set +x
done
}
load_created_kbn_archive() {
set -x
node scripts/kbn_archiver.js --config "$test_config" load "$new_archive"
set +x
}
unload_kbn() {
local archive=${1:-${new_archive}}
set -x
node scripts/kbn_archiver.js --config "$test_config" unload "$archive"
node scripts/kbn_archiver.js --config "$test_config" unload "$new_archive"
set +x
}
load_kbn_custom() {
load_kbn default "${newArchives[1]}"
create_space another-space "Another Space"
load_kbn another-space "${newArchives[2]}"
}
unload_kbns() {
local space=${1:-default}
unload_kbn_custom() {
unload_kbn "${newArchives[1]}"
delete_space another-space
for x in "${newArchives[@]}"; do
set -x
node scripts/kbn_archiver.js --config "$test_config" unload "$x"
set +x
done
}
ping_server() {

View file

@ -24,7 +24,7 @@ export function SpacesServiceProvider({ getService }: FtrProviderContext) {
return new (class SpacesService {
public async create(space: any) {
log.debug(`creating space ${space.name}`);
log.debug(`creating space ${space.id}`);
const { data, status, statusText } = await axios.post('/api/spaces/space', space);
if (status !== 200) {
@ -32,7 +32,7 @@ export function SpacesServiceProvider({ getService }: FtrProviderContext) {
`Expected status code of 200, received ${status} ${statusText}: ${util.inspect(data)}`
);
}
log.debug(`created space ${space}`);
log.debug(`created space ${space.id}`);
}
public async delete(spaceId: string) {

View file

@ -19,33 +19,31 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'spaceSelector', 'error']);
const appsMenu = getService('appsMenu');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
describe('spaces', () => {
const customSpace = 'custom_space';
before(async () => {
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional');
});
describe('space with no features disabled', () => {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await esArchiver.load(
'x-pack/test/functional/es_archives/dashboard/feature_controls/spaces'
);
await spacesService.create({
id: 'custom_space',
name: 'custom_space',
id: customSpace,
name: customSpace,
disabledFeatures: [],
});
});
after(async () => {
await spacesService.delete('custom_space');
await esArchiver.unload(
'x-pack/test/functional/es_archives/dashboard/feature_controls/spaces'
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/dashboard/feature_controls/custom_space',
{ space: customSpace }
);
});
after(async () => await spacesService.delete(customSpace));
it('shows dashboard navlink', async () => {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',
@ -88,7 +86,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
it(`can view existing Dashboard`, async () => {
await PageObjects.common.navigateToActualUrl(
'dashboard',
createDashboardEditUrl('i-exist'),
createDashboardEditUrl('8fba09d8-df3f-5aa1-83cc-65f7fbcbc0d9'),
{
basePath: '/s/custom_space',
ensureCurrentUrl: false,
@ -103,25 +101,21 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('space with Dashboard disabled', () => {
before(async () => {
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await esArchiver.load(
'x-pack/test/functional/es_archives/dashboard/feature_controls/spaces'
);
await spacesService.create({
id: 'custom_space',
name: 'custom_space',
id: customSpace,
name: customSpace,
disabledFeatures: ['dashboard'],
});
});
after(async () => {
await spacesService.delete('custom_space');
await esArchiver.unload(
'x-pack/test/functional/es_archives/dashboard/feature_controls/spaces'
// we need to load the following in every situation as deleting
// a space deletes all of the associated saved objects
await kibanaServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/dashboard/feature_controls/custom_space',
{ space: customSpace }
);
});
after(async () => await spacesService.delete('custom_space'));
it(`doesn't show dashboard navlink`, async () => {
await PageObjects.common.navigateToApp('home', {
basePath: '/s/custom_space',

File diff suppressed because one or more lines are too long

View file

@ -1,421 +0,0 @@
{
"type": "index",
"value": {
"aliases": {
".kibana": {}
},
"index": ".kibana_1",
"settings": {
"index": {
"number_of_shards": "1",
"auto_expand_replicas": "0-1",
"number_of_replicas": "0"
}
},
"mappings": {
"dynamic": "strict",
"properties": {
"apm-telemetry": {
"properties": {
"has_any_services": {
"type": "boolean"
},
"services_per_agent": {
"properties": {
"go": {
"type": "long",
"null_value": 0
},
"java": {
"type": "long",
"null_value": 0
},
"js-base": {
"type": "long",
"null_value": 0
},
"nodejs": {
"type": "long",
"null_value": 0
},
"python": {
"type": "long",
"null_value": 0
},
"ruby": {
"type": "long",
"null_value": 0
}
}
}
}
},
"canvas-workpad": {
"dynamic": "false",
"properties": {
"@created": {
"type": "date"
},
"@timestamp": {
"type": "date"
},
"id": {
"type": "text",
"index": false
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
},
"config": {
"dynamic": "true",
"properties": {
"accessibility:disableAnimations": {
"type": "boolean"
},
"buildNum": {
"type": "keyword"
},
"dateFormat:tz": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"defaultIndex": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"telemetry:optIn": {
"type": "boolean"
}
}
},
"dashboard": {
"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"
}
}
},
"gis-map" : {
"properties" : {
"bounds": {
"dynamic": false,
"properties": {}
},
"description" : {
"type" : "text"
},
"layerListJSON" : {
"type" : "text"
},
"mapStateJSON" : {
"type" : "text"
},
"title" : {
"type" : "text"
},
"uiStateJSON" : {
"type" : "text"
},
"version" : {
"type" : "integer"
}
}
},
"graph-workspace": {
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"numLinks": {
"type": "integer"
},
"numVertices": {
"type": "integer"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
},
"wsState": {
"type": "text"
}
}
},
"index-pattern": {
"properties": {
"fieldFormatMap": {
"type": "text"
},
"fields": {
"type": "text"
},
"intervalName": {
"type": "keyword"
},
"notExpandable": {
"type": "boolean"
},
"sourceFilters": {
"type": "text"
},
"timeFieldName": {
"type": "keyword"
},
"title": {
"type": "text"
},
"type": {
"type": "keyword"
},
"typeMeta": {
"type": "keyword"
}
}
},
"kql-telemetry": {
"properties": {
"optInCount": {
"type": "long"
},
"optOutCount": {
"type": "long"
}
}
},
"migrationVersion": {
"dynamic": "true",
"properties": {
"index-pattern": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"space": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"namespace": {
"type": "keyword"
},
"search": {
"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": {
"properties": {
"uuid": {
"type": "keyword"
}
}
},
"space": {
"properties": {
"_reserved": {
"type": "boolean"
},
"color": {
"type": "keyword"
},
"description": {
"type": "text"
},
"disabledFeatures": {
"type": "keyword"
},
"initials": {
"type": "keyword"
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 2048
}
}
}
}
},
"spaceId": {
"type": "keyword"
},
"telemetry": {
"properties": {
"enabled": {
"type": "boolean"
}
}
},
"type": {
"type": "keyword"
},
"updated_at": {
"type": "date"
},
"url": {
"properties": {
"accessCount": {
"type": "long"
},
"accessDate": {
"type": "date"
},
"createDate": {
"type": "date"
},
"url": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 2048
}
}
}
}
},
"visualization": {
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"savedSearchId": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
},
"visState": {
"type": "text"
}
}
}
}
}
}
}

File diff suppressed because one or more lines are too long