-
Notifications
You must be signed in to change notification settings - Fork 399
upcoming: [M3-8465] β Add "Volume Encryption" section to "Create and Attach Volume" drawer #10837
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
Changes from all commits
1752e01
6f04ede
22adfad
c143d1f
3b87504
c828e21
32b47b4
2c00ca2
174d7a7
77f9232
1fa0029
3d71087
b8dd4c3
4d02471
8012b0c
3126161
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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/api-v4": Upcoming Features | ||
| --- | ||
|
|
||
| Change 'bs_encryption_supported' property on Linode object to 'capabilities' ([#10837](https://github.com/linode/manager/pull/10837)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Tests | ||
| --- | ||
|
|
||
| Unit test for LinodeVolumeAddDrawer and E2E test for client library update notices in Create/Attach Volume drawer ([#10837](https://github.com/linode/manager/pull/10837)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Upcoming Features | ||
| --- | ||
|
|
||
| Support Volume Encryption and associated notices in Create/Attach Volume drawer ([#10837](https://github.com/linode/manager/pull/10837)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,20 @@ | ||
| import type { Linode } from '@linode/api-v4'; | ||
| import type { Linode, Region } from '@linode/api-v4'; | ||
| import { createTestLinode } from 'support/util/linodes'; | ||
| import { createLinodeRequestFactory } from 'src/factories/linodes'; | ||
| import { authenticate } from 'support/api/authentication'; | ||
| import { cleanUp } from 'support/util/cleanup'; | ||
| import { interceptCreateVolume } from 'support/intercepts/volumes'; | ||
| import { | ||
| interceptCreateVolume, | ||
| mockGetVolume, | ||
| mockGetVolumes, | ||
| } from 'support/intercepts/volumes'; | ||
| import { randomNumber, randomString, randomLabel } from 'support/util/random'; | ||
| import { chooseRegion } from 'support/util/regions'; | ||
| import { ui } from 'support/ui'; | ||
| import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags'; | ||
| import { accountFactory, regionFactory, volumeFactory } from 'src/factories'; | ||
| import { mockGetAccount } from 'support/intercepts/account'; | ||
| import { mockGetRegions } from 'support/intercepts/regions'; | ||
|
|
||
| // Local storage override to force volume table to list up to 100 items. | ||
| // This is a workaround while we wait to get stuck volumes removed. | ||
|
|
@@ -15,6 +23,18 @@ const pageSizeOverride = { | |
| PAGE_SIZE: 100, | ||
| }; | ||
|
|
||
| const mockRegions: Region[] = [ | ||
| regionFactory.build({ | ||
| capabilities: ['Linodes', 'Block Storage', 'Block Storage Encryption'], | ||
| id: 'us-east', | ||
| label: 'Newark, NJ', | ||
| site_type: 'core', | ||
| }), | ||
| ]; | ||
|
|
||
| const CLIENT_LIBRARY_UPDATE_COPY = | ||
| 'This Linode requires a client library update and will need to be rebooted prior to attaching an encrypted volume.'; | ||
|
|
||
| authenticate(); | ||
| describe('volume create flow', () => { | ||
| before(() => { | ||
|
|
@@ -141,6 +161,75 @@ describe('volume create flow', () => { | |
| ); | ||
| }); | ||
|
|
||
| /* | ||
| * - Checks for Block Storage Encryption notices in the Create/Attach Volume drawer from the | ||
| 'Storage' details page of an existing Linode. | ||
| */ | ||
| it('displays a warning notice re: rebooting for client library updates under the appropriate conditions', () => { | ||
| // Conditions: Block Storage encryption feature flag is on; user has Block Storage Encryption capability; Linode does not support Block Storage Encryption and the user is trying to attach an encrypted volume | ||
|
|
||
| // Mock feature flag -- @TODO BSE: Remove feature flag once BSE is fully rolled out | ||
| mockAppendFeatureFlags({ | ||
| blockStorageEncryption: true, | ||
| }).as('getFeatureFlags'); | ||
|
|
||
| // Mock account response | ||
| const mockAccount = accountFactory.build({ | ||
| capabilities: ['Linodes', 'Block Storage Encryption'], | ||
| }); | ||
|
|
||
| mockGetAccount(mockAccount).as('getAccount'); | ||
| mockGetRegions(mockRegions).as('getRegions'); | ||
|
|
||
| const volume = volumeFactory.build({ | ||
| region: mockRegions[0].id, | ||
| encryption: 'enabled', | ||
| }); | ||
|
|
||
| const linodeRequest = createLinodeRequestFactory.build({ | ||
| label: randomLabel(), | ||
| root_pass: randomString(16), | ||
| region: mockRegions[0].id, | ||
| booted: false, | ||
| }); | ||
|
|
||
| cy.defer(() => createTestLinode(linodeRequest), 'creating Linode').then( | ||
| (linode: Linode) => { | ||
| mockGetVolumes([volume]).as('getVolumes'); | ||
| mockGetVolume(volume); | ||
|
|
||
| cy.visitWithLogin(`/linodes/${linode.id}/storage`); | ||
| cy.wait(['@getFeatureFlags', '@getAccount']); | ||
|
|
||
| // Click "Add Volume" button | ||
| cy.findByText('Add Volume').click(); | ||
|
|
||
| cy.get('[data-qa-drawer="true"]').within(() => { | ||
| cy.get('[data-qa-checked]').should('be.visible').click(); | ||
| }); | ||
|
|
||
| cy.findByText(CLIENT_LIBRARY_UPDATE_COPY).should('be.visible'); | ||
|
|
||
| // Ensure notice is cleared when switching views in drawer | ||
| cy.get('[data-qa-radio="Attach Existing Volume"]').click(); | ||
| cy.wait(['@getVolumes']); | ||
| cy.findByText(CLIENT_LIBRARY_UPDATE_COPY).should('not.exist'); | ||
|
|
||
| // Ensure notice is displayed in "Attach Existing Volume" view when an encrypted volume is selected | ||
| cy.findByPlaceholderText('Select a Volume') | ||
| .should('be.visible') | ||
| .click() | ||
| .type(`${volume.label}{downarrow}{enter}`); | ||
| ui.autocompletePopper | ||
| .findByTitle(volume.label) | ||
| .should('be.visible') | ||
| .click(); | ||
|
Contributor
Author
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. @jdamore-linode It seems that everything is good up until this point, and then the assertion on L228 causes the failure. Did some console.log'ing with the Cypress test running and
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. I see! When Cypress selects the Volume, Cloud fires off a Mocking that request fixes the issue, but surprisingly we don't have a mock util for that endpoint. You can add one to /**
* Intercepts GET request to fetch a Volume and mocks response.
*
* @param volume - Volume with which to mock response.
*
* @returns Cypress chainable.
*/
export const mockGetVolume = (volume: Volume): Cypress.Chainable<null> => {
return cy.intercept('GET', apiMatcher(`volumes/${volume.id}`), makeResponse(volume));
};Then you can set it up right around where you mock the other Volumes request at line ~198: mockGetVolumes([volume]).as('getVolumes');
mockGetVolume(volume);That caused the library update message to display for me and allowed the test to pass!
Contributor
Author
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. Awesome, thanks for helping get to the bottom of that! |
||
|
|
||
| cy.findByText(CLIENT_LIBRARY_UPDATE_COPY).should('be.visible'); | ||
| } | ||
| ); | ||
| }); | ||
|
|
||
| /* | ||
| * - Creates a volume from the 'Storage' details page of an existing Linode. | ||
| * - Confirms that volume is listed correctly on Linode 'Storage' details page. | ||
|
|
||
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.
May not be reflected in the API spec (yet), but this is how it was actually implemented. Reach out for Slack convo if needed.