-
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
Upgrade Assistant to New Platform Ready #50163
Conversation
- Reviving app + tests wip
… (tests working again)
…erShim and RequestShim
Fixed use of legacy server components
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
@elasticmachine merge upstream |
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.
SCSS review: Mostly file moves and removing ./
from paths. I did find one inherited problem that would be nice to fix in this PR. But otherwise, LGTM
...grade_assistant/public/np_ready/application/components/tabs/checkup/deprecations/_index.scss
Outdated
Show resolved
Hide resolved
💔 Build Failed |
💔 Build Failed |
…skip ci] * upstream/master: Move table-list-view to kibana-react (elastic#50046) [ML] Stats bar for data frame analytics (elastic#49464) [ML] Make navigation in tests more stable (elastic#50132) Migrate authorization subsystem to the new platform. (elastic#46145) Bugfix: Interpreter conversion of string to number should throw on NaN elastic#27788 (elastic#50063) Update dependency @elastic/charts to v14 (elastic#49947) [ML] Adding cloud specific ML node warning (elastic#50139) Fixing bugs in the Shareable Runtime (elastic#49965) Revert router base name for Uptime plugin to use hash in default path. (elastic#50095) Ability to have telemetry always opted in (elastic#49798) Add "Get Help" and "Kibana Feedback" links to the help popover (elastic#49797) Removes references to Elasticsearch mapping types (elastic#47610) [skip-ci] Replace coordinate map in Kibana getting started docs with Maps (elastic#50167) [ML] Indicate missing required privileges for import in File Data Viz (elastic#50147) [SIEM][Detection Engine] Removes technical debt and minor bug fixes (elastic#50111)
💔 Build Failed |
@elasticmachine merge upstream |
merge conflict between base and head |
* upstream/master: Remove internal platform types exports (elastic#50427) [APM] Document `apm_oss.metricsIndices` and `apm_oss.sourcemap… (elastic#50312) [Telemetry] Server side fetcher (elastic#50015) [SIEM] Detection engine placeholders (elastic#50220) [Uptime] Donut chart loader position centered vertically (elastic#50219) update telemetry banner notice text (elastic#50403) Fix aborting when searching without batching (elastic#49966) [Telemetry] Remove telemetry splash page and add conditional messaging (elastic#50189) Revert chromedriver update (elastic#50324) Remove deprecated argument include_type_name from ES calls (elastic#50285) [Maps] add settings to maps telemetry (elastic#50161) remove visualize loader (elastic#46910) Fix misuse of react-router and react-router-dom (elastic#50120)
@elasticmachine merge upstream |
💔 Build Failed |
💚 Build Succeeded |
* 'master' of github.com:elastic/kibana: (27 commits) [Rollup] Fix for clone job workflow (elastic#50501) Empty message "No data available" for Labels and User metadata sections missing (elastic#49846) [APM] Duration by Country map doesn't take `transactionName` into account (elastic#50315) Remove react references from core `Notifications` apis (elastic#49573) Updated APM Indices endpoints to use the SavedObjectsClient from the legacy request context, and set the apm-indices schema object to be namspace-agnostic [Metrics UI] Calculate interval based on the dataset's period (elastic#50194) chore(NA): add new platform discovered plugins as entry points to check for dependencies on clean dll tasks (elastic#50610) [Telemetry] change of optin status telemetry (elastic#50158) [SIEM][Detection Engine] REST API Additions (elastic#50514) [DOCS] Removes dashboard-only mode doc (elastic#50441) [Filters] Fix operator overflowing out popover (elastic#50030) Change telemetry optIn to default to true (elastic#50490) [Maps] make grid rectangles the default symbolization for geo grid source (elastic#50169) Allow registered applications to hide Kibana chrome (elastic#49795) Upgrade EUI to v14.9.0 (elastic#49678) [Metrics UI] Convert layouts to use React components (elastic#49134) [Search service] Add support for ES request preference (elastic#49424) [Newsfeed/Lint] fix chained fn lint (elastic#50515) [Monitoring] Fix logstash pipelines page in multi-cluster environment (elastic#50166) [SIEM] Events viewer fixes (elastic#50175) ...
💚 Build Succeeded |
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.
Left a couple of comments but overall looks good. Switching out the axios client and consuming more NP API's on the server-side could definitely be done as a separate PR.
x-pack/legacy/plugins/upgrade_assistant/public/np_ready/application/components/tabs.tsx
Show resolved
Hide resolved
...ic/np_ready/application/components/tabs/checkup/deprecations/reindex/polling_service.test.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/upgrade_assistant/server/np_ready/types.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/upgrade_assistant/server/np_ready/types.ts
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
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.
Like we discussed, I think core should make it easier to test your controllers in an isolated way, but they way you've set it up here gets us really far in terms of testing the controller's glue logic.
method: 'GET', | ||
options: { | ||
pre: [EsVersionPrecheck], | ||
server.router.get( |
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.
Nit: Because this mixes NP and legacy dependencies and the parameter/type is called server
it's non-obvious from reading the code if you're using legacy, a shimmed facade or NP API's here.
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.
I think that was partly the objective here 😅 . Ultimately this code shouldn't have to change much down the line.
it('returns a 426 if EsVersionCheck throws', async () => { | ||
(EsVersionPrecheck.method as jest.Mock).mockRejectedValue( | ||
new Boom(`blah`, { statusCode: 426 }) | ||
); | ||
|
||
const resp = await server.inject({ | ||
method: 'GET', | ||
url: '/api/upgrade_assistant/status', | ||
}); | ||
const resp = await serverShim.router.getHandler({ | ||
method: 'get', | ||
pathPattern: '/api/upgrade_assistant/status', | ||
})(ctxMock, createRequestMock(), kibanaResponseFactory); | ||
|
||
expect(resp.statusCode).toEqual(426); |
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.
Isn't it worth keeping this, otherwise you're not testing if your versionCheckHandlerWrapper
was applied, seems like you should be able to keep this test with your "test harness".
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.
So I'm specifically opting out of the wrapper using the jest mock above like:
jest.mock('../lib/es_version_precheck', () => ({
versionCheckHandlerWrapper: (a: any) => a,
}));
The bulk of the wrapper logic should be covered by es_version_precheck.test.ts
. But I hear what you're saying it would be nice to test them in concert but I think since the wrapper is so thin it didn't merit a full mock out.
💔 Build Failed |
I've created #51150 for enabling testing of controller logic. |
@elasticmachine merge upstream |
💚 Build Succeeded |
@jloleysens This PR should be backported to 7.x correct? My backport had merge conflicts in the upgrade_assistant directory so i've checked out my changes on top of master: #51787 Can you double check if those changes are correct please? |
* - Public NP Shim done - Reviving app + tests wip * Update components to consume via context and props instead of imports (tests working again) * Moved server files to np_ready dir, updated paths and introduced ServerShim and RequestShim * Removed unused comments Fixed use of legacy server components * Fix typings and add app context where needed * getSavedObjectsClient may be null, specifically during tests * Move styles for _index.scss file -> more specific file * Fix typings issue [skip ci] * Migrate to NP router
* Upgrade Assistant to New Platform Ready (#50163) * - Public NP Shim done - Reviving app + tests wip * Update components to consume via context and props instead of imports (tests working again) * Moved server files to np_ready dir, updated paths and introduced ServerShim and RequestShim * Removed unused comments Fixed use of legacy server components * Fix typings and add app context where needed * getSavedObjectsClient may be null, specifically during tests * Move styles for _index.scss file -> more specific file * Fix typings issue [skip ci] * Migrate to NP router * Removed legacy app.tsx * APM changes to NP * More defensive use of SemVer * Update copy and include apm_oss plugin in 7.x server shim * Update expected message in spec
Summary
Part of the refactoring of ES settings plugins to NP ready, this contribution updates Upgrade Assistant by:
Public
ui/...
dependency away and replacing with React Context where neededServer