-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable management plugins using contextRef #160671
Changes from 2 commits
c022176
30221f3
ef4e3da
1c817e7
656f7e4
713fe60
72faae1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,12 @@ import { schema, TypeOf } from '@kbn/config-schema'; | |
import { PluginConfigDescriptor } from '@kbn/core-plugins-server'; | ||
|
||
const configSchema = schema.object({ | ||
enabled: schema.boolean({ defaultValue: true }), | ||
enabled: schema.conditional( | ||
schema.contextRef('serverless'), | ||
true, | ||
schema.boolean({ defaultValue: true }), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By taking this approach, we also set the setting to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ++ I think the approach of explicitly setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! Good idea about adding a comment 👍 |
||
schema.never() | ||
), | ||
}); | ||
|
||
export type CloudDataMigrationConfig = TypeOf<typeof configSchema>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getPageObject, getService }: FtrProviderContext) { | ||
const commonPage = getPageObject('common'); | ||
const testSubjects = getService('testSubjects'); | ||
|
||
describe('Management', function () { | ||
describe('Disabled UIs', () => { | ||
const DISABLED_PLUGINS = [ | ||
{ | ||
appName: 'Upgrade Assistant', | ||
url: '/stack/upgrade_assistant', | ||
}, | ||
{ | ||
appName: 'Advanced Settings', | ||
url: '/kibana/settings', | ||
}, | ||
{ | ||
appName: 'Migrate', | ||
url: '/data/migrate_data', | ||
}, | ||
{ | ||
appName: 'Remote Clusters', | ||
url: '/data/remote_clusters', | ||
}, | ||
{ | ||
appName: 'Cross-Cluster Replication', | ||
url: '/data/cross_cluster_replication', | ||
}, | ||
{ | ||
appName: 'Snapshot and Restore', | ||
url: '/data/snapshot_restore', | ||
}, | ||
{ | ||
appName: 'Index Lifecycle Management', | ||
url: '/data/index_lifecycle_management', | ||
}, | ||
{ | ||
appName: 'Rollup Jobs', | ||
url: '/data/rollup_jobs', | ||
}, | ||
{ | ||
appName: 'License Management', | ||
url: '/stack/license_management', | ||
}, | ||
]; | ||
|
||
DISABLED_PLUGINS.forEach(({ appName, url }) => { | ||
it(`${appName} is not accessible`, async () => { | ||
await commonPage.navigateToUrl('management', url, { | ||
shouldUseHashForSubUrl: false, | ||
}); | ||
// If the route doesn't exist, the user will be redirected back to the Management landing page | ||
await testSubjects.exists('managementHome'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this breaks the common functional tests (I think related to work done via #159272). If I run the tests using the
common
config:Then, I get the following error:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah while this approach makes things safer in terms of minimizing our API surface area, the tradeoff is that serverless & self-managed need to be tested separately & common tests won't really work anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually related to the common serverless test suite. It looks like in #159272, a change was made so that the common suite runs directly with the
serverless.yml
file instead of specifying a project type. See: https://github.com/elastic/kibana/pull/159272/files#diff-818fc0329318f82bcee0547dfb8edb3800cce36ea3fad7c62d58363197d91366R28There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I misunderstood your comment. Looking at the code I'm wondering if what's throwing it off is that we aren't getting a
--serverless
cli flag at all when running the common tests. Ultimately that's what we look at in the environment to set the context ref accordingly, soschema.contextRef('serverless')
is likely returningfalse
.Poking around in
src/cli/serve.js
it appears we try to read from the provided config files as a backup method to determine if we're in serverless mode (if the--serverless
flag isn't explicitly passed), however I think we are checking for a top-levelserverless
value to be in the yml files, which I don't think we provide anywhere... so we may have a bug in that logic.FYI @jbudz, this might be a bug, but keep me honest if I'm misreading things :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, should have clarified 😅
Ah, I see. @jbudz let me know if you'd like me to open up an issue or if I can help in any way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests were fixed via #160783