Skip to content

Commit

Permalink
[Archive Migration] x-pack-banners/multispace (#135783)
Browse files Browse the repository at this point in the history
* [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:
#135783 (comment)

* 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>
  • Loading branch information
wayneseymour and kibanamachine authored Sep 27, 2022
1 parent ead1cf3 commit 3edba25
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 344 deletions.
22 changes: 4 additions & 18 deletions scripts/archive_migration_functions.sh
Original file line number Diff line number Diff line change
@@ -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() {

Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/bin/scripts/kibana
Original file line number Diff line number Diff line change
Expand Up @@ -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" "${@}"
6 changes: 4 additions & 2 deletions x-pack/plugins/banners/server/ui_settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand All @@ -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),
});
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/banners_functional/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"',
],
},
};
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/banners_functional/tests/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
}
23 changes: 12 additions & 11 deletions x-pack/test/banners_functional/tests/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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');
Expand All @@ -51,15 +52,15 @@ 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 () => {
await PageObjects.security.forceLogout();
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');
});
});
}
62 changes: 0 additions & 62 deletions x-pack/test/functional/es_archives/banners/multispace/data.json

This file was deleted.

Loading

0 comments on commit 3edba25

Please sign in to comment.