Repository navigation
feat: [M3-7801] - Reintroduce NVMe Volume Upgrades #10229
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
Merged
bnussman-akamai
merged 14 commits into
linode:develop
from
bnussman-akamai:M3-7801-reintroduce-volume-upgrade-migrations
Feb 27, 2024
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cf41199
inital work for re-adding the NVMe upgrade feature
bnussman bcc0cb2
expose progress
bnussman 111323a
clean up the cypress test
bnussman faed07d
finish up and test
bnussman 1b44eb6
move utils to seperate file
bnussman 7f52d53
final tweaks and changeset
bnussman 257623d
fix some spelling
bnussman 3fd28d1
remove old unused code
bnussman 076a6e3
clean up optional chaining
bnussman c967349
fix: account for api delay
bnussman 3950181
use a better banner color
bnussman 8ece642
add chip spacing @mjac0bs
bnussman 09486e8
feedback from @jdamore-linode
bnussman adbb04e
pref: feedback from @jdamore-linode
bnussman 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
This file contains hidden or 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,5 @@ | ||
| --- | ||
| "@linode/manager": Added | ||
| --- | ||
|
|
||
| Reintroduce NVMe Volume Upgrades ([#10229](https://github.com/linode/manager/pull/10229)) |
270 changes: 270 additions & 0 deletions
270
packages/manager/cypress/e2e/core/volumes/upgrade-volume.spec.ts
This file contains hidden or 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,270 @@ | ||
| import { | ||
| eventFactory, | ||
| linodeFactory, | ||
| notificationFactory, | ||
| volumeFactory, | ||
| } from '@src/factories'; | ||
| import { mockGetEvents, mockGetNotifications } from 'support/intercepts/events'; | ||
| import { | ||
| mockGetLinodeDetails, | ||
| mockGetLinodeDisks, | ||
| mockGetLinodeVolumes, | ||
| } from 'support/intercepts/linodes'; | ||
| import { mockMigrateVolumes, mockGetVolumes } from 'support/intercepts/volumes'; | ||
| import { ui } from 'support/ui'; | ||
|
|
||
| describe('volume upgrade/migration', () => { | ||
| it('can upgrade an unattached volume to NVMe', () => { | ||
| const volume = volumeFactory.build(); | ||
|
|
||
| const migrationScheduledNotification = notificationFactory.build({ | ||
| type: 'volume_migration_scheduled', | ||
| entity: { type: 'volume', id: volume.id }, | ||
| }); | ||
|
|
||
| mockGetVolumes([volume]).as('getVolumes'); | ||
| mockMigrateVolumes().as('migrateVolumes'); | ||
| mockGetNotifications([migrationScheduledNotification]).as( | ||
| 'getNotifications' | ||
| ); | ||
|
|
||
| cy.visitWithLogin('/volumes'); | ||
|
|
||
| cy.wait(['@getVolumes', '@getNotifications']); | ||
|
|
||
| cy.findByText('UPGRADE TO NVMe') | ||
| .should('be.visible') | ||
| .should('be.enabled') | ||
| .click(); | ||
|
|
||
| const migrationImminentNotification = notificationFactory.build({ | ||
| type: 'volume_migration_imminent', | ||
| entity: { type: 'volume', id: volume.id }, | ||
| }); | ||
| mockGetNotifications([migrationImminentNotification]).as( | ||
| 'getNotifications' | ||
| ); | ||
|
|
||
| ui.dialog.findByTitle(`Upgrade Volume ${volume.label}`).within(() => { | ||
| ui.button | ||
| .findByTitle('Enter Upgrade Queue') | ||
| .should('be.visible') | ||
| .should('be.enabled') | ||
| .click(); | ||
| }); | ||
|
|
||
| cy.wait(['@migrateVolumes', '@getNotifications']); | ||
|
|
||
| cy.findByText('UPGRADE PENDING').should('be.visible'); | ||
|
|
||
| for (const percentage of [10, 20, 50, 75]) { | ||
| const mockStartedMigrationEvent = eventFactory.build({ | ||
| action: 'volume_migrate', | ||
| entity: { id: volume.id, type: 'volume' }, | ||
| status: 'started', | ||
| percent_complete: percentage, | ||
| }); | ||
|
|
||
| mockGetEvents([mockStartedMigrationEvent]).as('getEvents'); | ||
|
|
||
| cy.wait('@getEvents'); | ||
|
|
||
| cy.findByText(`migrating (${percentage}%)`).should('be.visible'); | ||
| } | ||
|
|
||
| const mockFinishedMigrationEvent = eventFactory.build({ | ||
| action: 'volume_migrate', | ||
| entity: { id: volume.id, type: 'volume', label: volume.label }, | ||
| status: 'finished', | ||
| }); | ||
|
|
||
| mockGetEvents([mockFinishedMigrationEvent]).as('getEvents'); | ||
| mockGetNotifications([]).as('getNotifications'); | ||
|
|
||
| cy.wait(['@getEvents', '@getVolumes', '@getNotifications']); | ||
|
|
||
| mockGetEvents([]); | ||
|
|
||
| cy.findByText('active').should('be.visible'); | ||
|
|
||
| ui.toast.assertMessage(`Volume ${volume.label} successfully upgraded.`); | ||
| }); | ||
|
|
||
| it('can upgrade an attached volume from the volumes landing page', () => { | ||
| const linode = linodeFactory.build(); | ||
| const volume = volumeFactory.build({ | ||
| linode_id: linode.id, | ||
| linode_label: linode.label, | ||
| }); | ||
|
|
||
| const migrationScheduledNotification = notificationFactory.build({ | ||
| type: 'volume_migration_scheduled', | ||
| entity: { type: 'volume', id: volume.id }, | ||
| }); | ||
|
|
||
| mockGetVolumes([volume]).as('getVolumes'); | ||
| mockMigrateVolumes().as('migrateVolumes'); | ||
| mockGetLinodeDetails(linode.id, linode).as('getLinode'); | ||
| mockGetLinodeDisks(linode.id, []); | ||
| mockGetNotifications([migrationScheduledNotification]).as( | ||
| 'getNotifications' | ||
| ); | ||
| mockGetLinodeVolumes(linode.id, [volume]).as('getLinodeVolumes'); | ||
|
|
||
| cy.visitWithLogin('/volumes'); | ||
|
|
||
| cy.wait(['@getVolumes', '@getNotifications']); | ||
|
|
||
| cy.findByText('UPGRADE TO NVMe') | ||
| .should('be.visible') | ||
| .should('be.enabled') | ||
| .click(); | ||
|
|
||
| cy.url().should('contain', `/linodes/${linode.id}/storage?upgrade=true`); | ||
|
|
||
| cy.wait(['@getLinode', '@getLinodeVolumes']); | ||
|
|
||
| const migrationImminentNotification = notificationFactory.build({ | ||
| type: 'volume_migration_imminent', | ||
| entity: { type: 'volume', id: volume.id }, | ||
| }); | ||
| mockGetNotifications([migrationImminentNotification]).as( | ||
| 'getNotifications' | ||
| ); | ||
|
|
||
| ui.dialog.findByTitle('Upgrade Volume').within(() => { | ||
| cy.findByText( | ||
| `A Volume attached to Linode ${linode.label} will be upgraded to high-performance NVMe Block Storage.`, | ||
| { exact: false } | ||
| ).should('be.visible'); | ||
|
|
||
| ui.button | ||
| .findByTitle('Enter Upgrade Queue') | ||
| .should('be.visible') | ||
| .should('be.enabled') | ||
| .click(); | ||
| }); | ||
| cy.wait(['@migrateVolumes', '@getNotifications']); | ||
|
|
||
| cy.findByText('UPGRADE PENDING').should('be.visible'); | ||
|
|
||
| for (const percentage of [10, 20, 50, 75]) { | ||
|
Contributor
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. In case there was any question while developing this, just want to point out that we can use (Feel free to disregard this if you opted for |
||
| const mockStartedMigrationEvent = eventFactory.build({ | ||
| action: 'volume_migrate', | ||
| entity: { id: volume.id, type: 'volume' }, | ||
| status: 'started', | ||
| percent_complete: percentage, | ||
| }); | ||
|
|
||
| mockGetEvents([mockStartedMigrationEvent]).as('getEvents'); | ||
|
|
||
| cy.wait('@getEvents'); | ||
|
|
||
| cy.findByText(`migrating (${percentage}%)`).should('be.visible'); | ||
| } | ||
|
|
||
| const mockFinishedMigrationEvent = eventFactory.build({ | ||
| action: 'volume_migrate', | ||
| entity: { id: volume.id, type: 'volume', label: volume.label }, | ||
| status: 'finished', | ||
| }); | ||
|
|
||
| mockGetEvents([mockFinishedMigrationEvent]).as('getEvents'); | ||
| mockGetNotifications([]).as('getNotifications'); | ||
|
|
||
| cy.wait(['@getEvents', '@getLinodeVolumes', '@getNotifications']); | ||
|
|
||
| mockGetEvents([]); | ||
|
|
||
| cy.findByText('active').should('be.visible'); | ||
|
|
||
| ui.toast.assertMessage(`Volume ${volume.label} successfully upgraded.`); | ||
| }); | ||
|
|
||
| it('can upgrade an attached volume from the linode details page', () => { | ||
| const linode = linodeFactory.build(); | ||
| const volume = volumeFactory.build({ | ||
| linode_id: linode.id, | ||
| linode_label: linode.label, | ||
| }); | ||
|
|
||
| const migrationScheduledNotification = notificationFactory.build({ | ||
| type: 'volume_migration_scheduled', | ||
| entity: { type: 'volume', id: volume.id }, | ||
| }); | ||
|
|
||
| mockMigrateVolumes().as('migrateVolumes'); | ||
| mockGetLinodeDetails(linode.id, linode).as('getLinode'); | ||
| mockGetLinodeDisks(linode.id, []); | ||
| mockGetNotifications([migrationScheduledNotification]).as( | ||
| 'getNotifications' | ||
| ); | ||
| mockGetLinodeVolumes(linode.id, [volume]).as('getLinodeVolumes'); | ||
|
|
||
| cy.visitWithLogin(`/linodes/${linode.id}/storage`); | ||
|
|
||
| cy.wait(['@getLinode', '@getLinodeVolumes', '@getNotifications']); | ||
|
|
||
| ui.button | ||
| .findByTitle('Upgrade Volume') | ||
| .should('be.visible') | ||
| .should('be.enabled') | ||
| .click(); | ||
|
|
||
| const migrationImminentNotification = notificationFactory.build({ | ||
| type: 'volume_migration_imminent', | ||
| entity: { type: 'volume', id: volume.id }, | ||
| }); | ||
| mockGetNotifications([migrationImminentNotification]).as( | ||
| 'getNotifications' | ||
| ); | ||
|
|
||
| ui.dialog.findByTitle('Upgrade Volume').within(() => { | ||
| cy.findByText( | ||
| `A Volume attached to Linode ${linode.label} will be upgraded to high-performance NVMe Block Storage.`, | ||
| { exact: false } | ||
| ).should('be.visible'); | ||
|
|
||
| ui.button | ||
| .findByTitle('Enter Upgrade Queue') | ||
| .should('be.visible') | ||
| .should('be.enabled') | ||
| .click(); | ||
| }); | ||
| cy.wait(['@migrateVolumes', '@getNotifications']); | ||
|
|
||
| cy.findByText('UPGRADE PENDING').should('be.visible'); | ||
|
|
||
| for (const percentage of [10, 20, 50, 75]) { | ||
| const mockStartedMigrationEvent = eventFactory.build({ | ||
| action: 'volume_migrate', | ||
| entity: { id: volume.id, type: 'volume' }, | ||
| status: 'started', | ||
| percent_complete: percentage, | ||
| }); | ||
|
|
||
| mockGetEvents([mockStartedMigrationEvent]).as('getEvents'); | ||
|
|
||
| cy.wait('@getEvents'); | ||
|
|
||
| cy.findByText(`migrating (${percentage}%)`).should('be.visible'); | ||
| } | ||
|
|
||
| const mockFinishedMigrationEvent = eventFactory.build({ | ||
| action: 'volume_migrate', | ||
| entity: { id: volume.id, type: 'volume', label: volume.label }, | ||
| status: 'finished', | ||
| }); | ||
|
|
||
| mockGetEvents([mockFinishedMigrationEvent]).as('getEvents'); | ||
| mockGetNotifications([]).as('getNotifications'); | ||
|
|
||
| cy.wait(['@getEvents', '@getLinodeVolumes', '@getNotifications']); | ||
|
|
||
| mockGetEvents([]); | ||
|
|
||
| cy.findByText('active').should('be.visible'); | ||
|
|
||
| ui.toast.assertMessage(`Volume ${volume.label} successfully upgraded.`); | ||
| }); | ||
| }); | ||
This file contains hidden or 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 hidden or 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 hidden or 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.
Thanks for including this E2E!