mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.11`: - [Fixes rendering service config keys test (#167937)](https://github.com/elastic/kibana/pull/167937) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jeramy Soucy","email":"jeramy.soucy@elastic.co"},"sourceCommit":{"committedDate":"2023-10-05T17:59:19Z","message":"Fixes rendering service config keys test (#167937)\n\nCloses #167142\r\nCloses #157126\r\n\r\n## Summary\r\n\r\nFortifies the rendering service tests by introducing a retry loop to get\r\ninjected metadata after navigation. The `kbn-injected-metadata` tag that\r\nwe're relying on in this test gets removed some time after navigation\r\n(e.g. to `.../render/core`). It appears that occasionally this test\r\nfails to read the tag before it is removed.\r\n\r\nFlaky test runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3363\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"335a751c00b2743d4e4adf53425f1fb45a54e883","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","release_note:skip","backport:all-open","v8.11.0","v8.12.0"],"number":167937,"url":"https://github.com/elastic/kibana/pull/167937","mergeCommit":{"message":"Fixes rendering service config keys test (#167937)\n\nCloses #167142\r\nCloses #157126\r\n\r\n## Summary\r\n\r\nFortifies the rendering service tests by introducing a retry loop to get\r\ninjected metadata after navigation. The `kbn-injected-metadata` tag that\r\nwe're relying on in this test gets removed some time after navigation\r\n(e.g. to `.../render/core`). It appears that occasionally this test\r\nfails to read the tag before it is removed.\r\n\r\nFlaky test runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3363\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"335a751c00b2743d4e4adf53425f1fb45a54e883"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/167937","number":167937,"mergeCommit":{"message":"Fixes rendering service config keys test (#167937)\n\nCloses #167142\r\nCloses #157126\r\n\r\n## Summary\r\n\r\nFortifies the rendering service tests by introducing a retry loop to get\r\ninjected metadata after navigation. The `kbn-injected-metadata` tag that\r\nwe're relying on in this test gets removed some time after navigation\r\n(e.g. to `.../render/core`). It appears that occasionally this test\r\nfails to read the tag before it is removed.\r\n\r\nFlaky test runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3363\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"335a751c00b2743d4e4adf53425f1fb45a54e883"}}]}] BACKPORT--> Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
This commit is contained in:
parent
c65f469ce2
commit
de6dcb416d
1 changed files with 30 additions and 7 deletions
|
@ -31,6 +31,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
const deployment = getService('deployment');
|
||||
const find = getService('find');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const retry = getService('retry');
|
||||
|
||||
const navigateTo = async (path: string) =>
|
||||
await browser.navigateTo(`${deployment.getHostPort()}${path}`);
|
||||
|
@ -47,7 +48,16 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
|
||||
const getInjectedMetadata = () =>
|
||||
browser.execute(() => {
|
||||
return JSON.parse(document.querySelector('kbn-injected-metadata')!.getAttribute('data')!);
|
||||
const injectedMetadata = document.querySelector('kbn-injected-metadata');
|
||||
// null/hasAttribute check and explicit error for better future troublehsooting
|
||||
// (see https://github.com/elastic/kibana/issues/167142)
|
||||
// The 'kbn-injected-metadata' tag that we're relying on here gets removed
|
||||
// some time after navigation (e.g. to /render/core). It appears that
|
||||
// occasionally this test fails to read the tag before it is removed.
|
||||
if (!injectedMetadata?.hasAttribute('data')) {
|
||||
throw new Error(`'kbn-injected-metadata.data' not found.`);
|
||||
}
|
||||
return JSON.parse(injectedMetadata.getAttribute('data')!);
|
||||
});
|
||||
const getUserSettings = () =>
|
||||
browser.execute(() => {
|
||||
|
@ -61,11 +71,17 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
return window.__RENDERING_SESSION__;
|
||||
});
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/167142
|
||||
describe.skip('rendering service', () => {
|
||||
describe('rendering service', () => {
|
||||
it('exposes plugin config settings to authenticated users', async () => {
|
||||
await navigateTo('/render/core');
|
||||
const injectedMetadata = await getInjectedMetadata();
|
||||
// This retry loop to get the injectedMetadata is to overcome flakiness
|
||||
// (see comment in getInjectedMetadata)
|
||||
let injectedMetadata: Partial<{ uiPlugins: any }> = { uiPlugins: undefined };
|
||||
await retry.waitFor('injectedMetadata', async () => {
|
||||
await navigateTo('/render/core');
|
||||
injectedMetadata = await getInjectedMetadata();
|
||||
return !!injectedMetadata;
|
||||
});
|
||||
|
||||
expect(injectedMetadata).to.not.be.empty();
|
||||
expect(injectedMetadata.uiPlugins).to.not.be.empty();
|
||||
|
||||
|
@ -317,12 +333,19 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
|
|||
// abundantly clear when the test fails that (A) Kibana is exposing a new key, or (B) Kibana is no longer exposing a key.
|
||||
const extra = _.difference(actualExposedConfigKeys, expectedExposedConfigKeys).sort();
|
||||
const missing = _.difference(expectedExposedConfigKeys, actualExposedConfigKeys).sort();
|
||||
|
||||
expect({ extra, missing }).to.eql({ extra: [], missing: [] }, EXPOSED_CONFIG_SETTINGS_ERROR);
|
||||
});
|
||||
|
||||
it('exposes plugin config settings to unauthenticated users', async () => {
|
||||
await navigateTo('/render/core?isAnonymousPage=true');
|
||||
const injectedMetadata = await getInjectedMetadata();
|
||||
// This retry loop to get the injectedMetadata is to overcome flakiness
|
||||
// (see comment in getInjectedMetadata)
|
||||
let injectedMetadata: Partial<{ uiPlugins: any }> = { uiPlugins: undefined };
|
||||
await retry.waitFor('injectedMetadata', async () => {
|
||||
await navigateTo('/render/core?isAnonymousPage=true');
|
||||
injectedMetadata = await getInjectedMetadata();
|
||||
return !!injectedMetadata;
|
||||
});
|
||||
expect(injectedMetadata).to.not.be.empty();
|
||||
expect(injectedMetadata.uiPlugins).to.not.be.empty();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue