[Archive Migration] x-pack-banners/multispace (#135783)

* [Archive Migration] x-pack-banners/multispace

I've the before() fn loading the new kbn archive
containing one config, for the default space.
Then, the fn creates a new space and changes the ui settings of this new space,
w/o using an archive.

* Move to enabled per:
https://github.com/elastic/kibana/pull/135783#issuecomment-1237228021

* Just run my stuff this go-round.

* Fixup.

* Drop new archive,
re-enable all tests,
skip the last test,
and add the filed bugs.

* Whoops

* Drop redundant test.

* Not sure what's what yet,
but I think perhaps an override is occuring.

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Change value in test and config.

* Drop double quotes,
seems to have caused parsing issue.

* One more try before asking in kibana-core

* try snake case

* back to space case but
without quotes in the config

* Just to see what happens I guess.

* Merge fixups.

* Change refs of "global_banner_text" to
 "global banner text"

* Stop the shell expansion

* Drop duplicate.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Tre 2022-09-27 12:03:01 +01:00 committed by GitHub
parent ead1cf386d
commit 3edba25c2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 344 deletions

View file

@ -1,27 +1,13 @@
#!/bin/bash
# ??? Should we migrate
# x-pack/test/functional/es_archives/logstash/example_pipelines
# !!! No, we've found 0 saved objects that are listed in the standard_list
# !!! It contains the following saved object(s)
# config
# space
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/spaces/multi_space"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/spaces/multi_space"
orig_archive="x-pack/test/functional/es_archives/banners/multispace"
new_archive="x-pack/test/functional/fixtures/kbn_archiver/banners/multi_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")
testFiles=("x-pack/test/functional/apps/discover/preserve_url.ts")
testFiles+=("x-pack/test/functional/apps/visualize/preserve_url.ts")
testFiles+=("x-pack/test/functional/apps/dashboard/group1/preserve_url.ts")
# testFiles=("x-pack/test/functional/apps/discover/preserve_url.ts")
test_config="x-pack/test/functional/apps/dashboard/group1/config.ts"
# test_config="x-pack/test/functional/apps/discover/config.ts"
# test_config="x-pack/test/functional/apps/visualize/config.ts"
test_config="x-pack/test/banners_functional/config.ts"
list_stragglers() {

View file

@ -26,4 +26,4 @@ if [ -f "${CONFIG_DIR}/node.options" ]; then
KBN_NODE_OPTS="$(grep -v ^# < ${CONFIG_DIR}/node.options | xargs)"
fi
NODE_OPTIONS="--no-warnings --max-http-header-size=65536 $KBN_NODE_OPTS $NODE_OPTIONS" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli/dist" ${@}
NODE_OPTIONS="--no-warnings --max-http-header-size=65536 $KBN_NODE_OPTS $NODE_OPTIONS" NODE_ENV=production exec "${NODE}" "${DIR}/src/cli/dist" "${@}"

View file

@ -13,7 +13,7 @@ const createConfig = (parts: Partial<BannersConfigType> = {}): BannersConfigType
placement: 'disabled',
backgroundColor: '#0000',
textColor: '#FFFFFF',
textContent: 'Hello from the banner',
textContent: 'some global banner text',
disableSpaceBanners: false,
...parts,
});
@ -31,7 +31,9 @@ describe('registerSettings', () => {
expect(uiSettings.register).toHaveBeenCalledTimes(1);
expect(uiSettings.register).toHaveBeenCalledWith({
'banners:placement': expect.any(Object),
'banners:textContent': expect.any(Object),
'banners:textContent': expect.objectContaining({
value: 'some global banner text',
}),
'banners:textColor': expect.any(Object),
'banners:backgroundColor': expect.any(Object),
});

View file

@ -35,7 +35,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
serverArgs: [
...kibanaFunctionalConfig.get('kbnTestServer.serverArgs'),
'--xpack.banners.placement=top',
'--xpack.banners.textContent=global_banner_text',
'--xpack.banners.textContent="global banner text"',
],
},
};

View file

@ -16,7 +16,7 @@ export default function ({ getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToApp('login');
expect(await PageObjects.banners.isTopBannerVisible()).to.eql(true);
expect(await PageObjects.banners.getTopBannerText()).to.eql('global_banner_text');
expect(await PageObjects.banners.getTopBannerText()).to.eql('global banner text');
});
});
}

View file

@ -9,7 +9,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';
export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces');
const kibanaServer = getService('kibanaServer');
const PageObjects = getPageObjects([
'common',
@ -21,14 +21,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('per-spaces banners', () => {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/banners/multispace');
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/banners/multispace');
});
before(async () => {
await spacesService.create({
id: 'another-space',
name: 'Another Space',
disabledFeatures: [],
});
await kibanaServer.uiSettings.replace(
{
'banners:textContent': 'default space banner text',
@ -39,6 +36,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expectSpaceSelector: true,
});
});
after(async () => {
await spacesService.delete('another-space');
await kibanaServer.savedObjects.cleanStandardList();
});
it('displays the space-specific banner within the space', async () => {
await PageObjects.common.navigateToApp('home');
@ -51,7 +52,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('home', { basePath: '/s/another-space' });
expect(await PageObjects.banners.isTopBannerVisible()).to.eql(true);
expect(await PageObjects.banners.getTopBannerText()).to.eql('global_banner_text');
expect(await PageObjects.banners.getTopBannerText()).to.eql('global banner text');
});
it('displays the global banner on the login page', async () => {
@ -59,7 +60,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await PageObjects.common.navigateToApp('login');
expect(await PageObjects.banners.isTopBannerVisible()).to.eql(true);
expect(await PageObjects.banners.getTopBannerText()).to.eql('global_banner_text');
expect(await PageObjects.banners.getTopBannerText()).to.eql('global banner text');
});
});
}

View file

@ -1,62 +0,0 @@
{
"type": "doc",
"value": {
"id": "config:6.0.0",
"index": ".kibana",
"source": {
"config": {
"buildNum": 8467,
"dateFormat:tz": "UTC",
"defaultRoute": "http://example.com/evil"
},
"type": "config"
}
}
}
{
"type": "doc",
"value": {
"id": "another-space:config:6.0.0",
"index": ".kibana",
"source": {
"namespace": "another-space",
"config": {
"buildNum": 8467,
"dateFormat:tz": "UTC",
"defaultRoute": "/app/canvas"
},
"type": "config"
}
}
}
{
"type": "doc",
"value": {
"id": "space:default",
"index": ".kibana",
"source": {
"space": {
"description": "This is the default space!",
"name": "Default"
},
"type": "space"
}
}
}
{
"type": "doc",
"value": {
"id": "space:another-space",
"index": ".kibana",
"source": {
"space": {
"description": "This is another space",
"name": "Another Space"
},
"type": "space"
}
}
}

View file

@ -1,248 +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"
},
"defaultRoute": {
"type": "keyword"
}
}
},
"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"
}
}
}
}