-
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
Add rolling upgrade interstitials to UA #112907
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7b58214
Refactor FixLogsStep to be explicit in which props are passed to Depr…
cjcenizal c54644b
Centralize error-handling logic in the api service using an intercept…
cjcenizal ea3bb80
Add note about intended use case of status API route.
cjcenizal 6bf989e
Add tests for interstitial states.
cjcenizal d359b6a
Revert changes to request module and support handling responses globa…
cjcenizal c6a9326
Fix TS errors.
cjcenizal db265e1
Add endpoint dedicated to surfacing the cluster upgrade state, and a …
cjcenizal 240e3b8
Merge branch '7.x' into ua/7.x/rolling-upgrade
cjcenizal 7733842
Merge App and AppWithRouter components.
cjcenizal ebafe06
Prevent flicker if the cluster status is 426 but we're waiting for it…
cjcenizal dbc7a8e
Reinstate version check for privileges route.
cjcenizal 983388e
Improve typing of ResponseError attributes, remove unused ResponseTyp…
cjcenizal e12329f
Clarify comment about the danger of an infinite render loop.
cjcenizal 3902332
Clarify the split of two components and the danger of an infinite ren…
cjcenizal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/app.helpers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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 { act } from 'react-dom/test-utils'; | ||
import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest'; | ||
|
||
import { App } from '../../../public/application/app'; | ||
import { WithAppDependencies } from '../helpers'; | ||
|
||
const testBedConfig: TestBedConfig = { | ||
memoryRouter: { | ||
initialEntries: [`/overview`], | ||
componentRoutePath: '/overview', | ||
}, | ||
doMountAsync: true, | ||
}; | ||
|
||
export type AppTestBed = TestBed & { | ||
actions: ReturnType<typeof createActions>; | ||
}; | ||
|
||
const createActions = (testBed: TestBed) => { | ||
const clickDeprecationToggle = async () => { | ||
const { find, component } = testBed; | ||
|
||
await act(async () => { | ||
find('deprecationLoggingToggle').simulate('click'); | ||
}); | ||
|
||
component.update(); | ||
}; | ||
|
||
return { | ||
clickDeprecationToggle, | ||
}; | ||
}; | ||
|
||
export const setupAppPage = async (overrides?: Record<string, unknown>): Promise<AppTestBed> => { | ||
const initTestBed = registerTestBed(WithAppDependencies(App, overrides), testBedConfig); | ||
const testBed = await initTestBed(); | ||
|
||
return { | ||
...testBed, | ||
actions: createActions(testBed), | ||
}; | ||
}; |
86 changes: 86 additions & 0 deletions
86
x-pack/plugins/upgrade_assistant/__jest__/client_integration/app/cluster_upgrade.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* 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 { act } from 'react-dom/test-utils'; | ||
|
||
import { setupEnvironment } from '../helpers'; | ||
import { AppTestBed, setupAppPage } from './app.helpers'; | ||
|
||
describe('Cluster upgrade', () => { | ||
let testBed: AppTestBed; | ||
let server: ReturnType<typeof setupEnvironment>['server']; | ||
let httpRequestsMockHelpers: ReturnType<typeof setupEnvironment>['httpRequestsMockHelpers']; | ||
|
||
beforeEach(() => { | ||
({ server, httpRequestsMockHelpers } = setupEnvironment()); | ||
}); | ||
|
||
afterEach(() => { | ||
server.restore(); | ||
}); | ||
|
||
describe('when user is still preparing for upgrade', () => { | ||
beforeEach(async () => { | ||
testBed = await setupAppPage(); | ||
}); | ||
|
||
test('renders overview', () => { | ||
const { exists } = testBed; | ||
expect(exists('overview')).toBe(true); | ||
expect(exists('isUpgradingMessage')).toBe(false); | ||
expect(exists('isUpgradeCompleteMessage')).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('when cluster is in the process of a rolling upgrade', () => { | ||
beforeEach(async () => { | ||
httpRequestsMockHelpers.setLoadDeprecationLoggingResponse(undefined, { | ||
statusCode: 426, | ||
message: '', | ||
attributes: { | ||
allNodesUpgraded: false, | ||
}, | ||
}); | ||
|
||
await act(async () => { | ||
testBed = await setupAppPage(); | ||
}); | ||
}); | ||
|
||
test('renders rolling upgrade message', async () => { | ||
const { component, exists } = testBed; | ||
component.update(); | ||
expect(exists('overview')).toBe(false); | ||
expect(exists('isUpgradingMessage')).toBe(true); | ||
expect(exists('isUpgradeCompleteMessage')).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('when cluster has been upgraded', () => { | ||
beforeEach(async () => { | ||
httpRequestsMockHelpers.setLoadDeprecationLoggingResponse(undefined, { | ||
statusCode: 426, | ||
message: '', | ||
attributes: { | ||
allNodesUpgraded: true, | ||
}, | ||
}); | ||
|
||
await act(async () => { | ||
testBed = await setupAppPage(); | ||
}); | ||
}); | ||
|
||
test('renders upgrade complete message', () => { | ||
const { component, exists } = testBed; | ||
component.update(); | ||
expect(exists('overview')).toBe(false); | ||
expect(exists('isUpgradingMessage')).toBe(false); | ||
expect(exists('isUpgradeCompleteMessage')).toBe(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what do you think about merging this component and AppWithRouter? they both feel quite small and it might reduce some of the overhead of reading this file which already has a bunch of components