Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Fix SubnetLinodeRow for Linodes using new interfaces ([#11953](https://github.com/linode/manager/pull/11953))
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
linodeFactory,
regionFactory,
} from '@linode/utilities';
import { mockGetLinodeConfigs } from 'support/intercepts/configs';
import { mockGetLinodeConfig } from 'support/intercepts/configs';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import {
mockCreateLinode,
Expand Down Expand Up @@ -82,7 +82,13 @@ describe('Create Linode with VPCs', () => {
linodes: [
{
id: mockLinode.id,
interfaces: [{ active: true, config_id: 1, id: mockInterface.id }],
interfaces: [
{
active: true,
config_id: mockLinodeConfig.id,
id: mockInterface.id,
},
],
},
],
};
Expand Down Expand Up @@ -150,13 +156,15 @@ describe('Create Linode with VPCs', () => {
mockGetVPC(mockVPC).as('getVPC');
mockGetSubnets(mockVPC.id, [mockUpdatedSubnet]).as('getSubnets');
mockGetLinodeDetails(mockLinode.id, mockLinode).as('getLinode');
mockGetLinodeConfigs(mockLinode.id, [mockLinodeConfig]).as(
'getLinodeConfigs'
);
mockGetLinodeConfig({
config: mockLinodeConfig,
configId: mockLinodeConfig.id,
linodeId: mockLinode.id,
}).as('getLinodeConfig');

cy.visit(`/vpcs/${mockVPC.id}`);
cy.findByLabelText(`expand ${mockSubnet.label} row`).click();
cy.wait('@getLinodeConfigs');
cy.wait('@getLinodeConfig');
cy.findByTestId(WARNING_ICON_UNRECOMMENDED_CONFIG).should('not.exist');
});

Expand Down Expand Up @@ -209,7 +217,13 @@ describe('Create Linode with VPCs', () => {
linodes: [
{
id: mockLinode.id,
interfaces: [{ active: true, config_id: 1, id: mockInterface.id }],
interfaces: [
{
active: true,
config_id: mockLinodeConfig.id,
id: mockInterface.id,
},
],
},
],
};
Expand Down Expand Up @@ -314,13 +328,15 @@ describe('Create Linode with VPCs', () => {
mockGetVPC(mockVPC).as('getVPC');
mockGetSubnets(mockVPC.id, [mockUpdatedSubnet]).as('getSubnets');
mockGetLinodeDetails(mockLinode.id, mockLinode).as('getLinode');
mockGetLinodeConfigs(mockLinode.id, [mockLinodeConfig]).as(
'getLinodeConfigs'
);
mockGetLinodeConfig({
config: mockLinodeConfig,
configId: mockLinodeConfig.id,
linodeId: mockLinode.id,
}).as('getLinodeConfig');

cy.visit(`/vpcs/${mockVPC.id}`);
cy.findByLabelText(`expand ${mockSubnet.label} row`).click();
cy.wait('@getLinodeConfigs');
cy.wait('@getLinodeConfig');
cy.findByTestId(WARNING_ICON_UNRECOMMENDED_CONFIG).should('not.exist');
});

Expand Down
63 changes: 47 additions & 16 deletions packages/manager/cypress/e2e/core/vpc/vpc-details-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
linodeFactory,
} from '@linode/utilities';
import { linodeConfigFactory, subnetFactory, vpcFactory } from '@src/factories';
import { mockGetLinodeConfigs } from 'support/intercepts/configs';
import { mockGetLinodeConfig } from 'support/intercepts/configs';
import { mockGetLinodeDetails } from 'support/intercepts/linodes';
import {
mockCreateSubnet,
Expand Down Expand Up @@ -277,6 +277,7 @@ describe('VPC details page', () => {
const linodeRegion = chooseRegion({ capabilities: ['VPCs'] });

const mockInterfaceId = randomNumber();
const mockConfigId = randomNumber();
const mockLinode = linodeFactory.build({
id: randomNumber(),
label: randomLabel(),
Expand All @@ -290,7 +291,13 @@ describe('VPC details page', () => {
linodes: [
{
id: mockLinode.id,
interfaces: [{ active: true, id: mockInterfaceId }],
interfaces: [
{
active: true,
config_id: mockConfigId,
id: mockInterfaceId,
},
],
},
],
});
Expand All @@ -304,25 +311,29 @@ describe('VPC details page', () => {

const mockInterface = linodeConfigInterfaceFactoryWithVPC.build({
active: true,
id: mockInterfaceId,
primary: true,
subnet_id: mockSubnet.id,
vpc_id: mockVPC.id,
});

const mockLinodeConfig = linodeConfigFactory.build({
id: mockConfigId,
interfaces: [mockInterface],
});

mockGetVPC(mockVPC).as('getVPC');
mockGetSubnets(mockVPC.id, [mockSubnet]).as('getSubnets');
mockGetLinodeDetails(mockLinode.id, mockLinode).as('getLinode');
mockGetLinodeConfigs(mockLinode.id, [mockLinodeConfig]).as(
'getLinodeConfigs'
);
mockGetLinodeConfig({
config: mockLinodeConfig,
configId: mockLinodeConfig.id,
linodeId: mockLinode.id,
}).as('getLinodeConfig');

cy.visitWithLogin(`/vpcs/${mockVPC.id}`);
cy.findByLabelText(`expand ${mockSubnet.label} row`).click();
cy.wait('@getLinodeConfigs');
cy.wait('@getLinodeConfig');
cy.findByTestId(WARNING_ICON_UNRECOMMENDED_CONFIG).should('not.exist');
});

Expand All @@ -333,6 +344,7 @@ describe('VPC details page', () => {
const linodeRegion = chooseRegion({ capabilities: ['VPCs'] });

const mockInterfaceId = randomNumber();
const mockConfigId = randomNumber();
const mockLinode = linodeFactory.build({
id: randomNumber(),
label: randomLabel(),
Expand All @@ -346,7 +358,13 @@ describe('VPC details page', () => {
linodes: [
{
id: mockLinode.id,
interfaces: [{ active: true, id: mockInterfaceId }],
interfaces: [
{
active: true,
config_id: mockConfigId,
id: mockInterfaceId,
},
],
},
],
});
Expand All @@ -367,19 +385,22 @@ describe('VPC details page', () => {
});

const mockLinodeConfig = linodeConfigFactory.build({
id: mockConfigId,
interfaces: [mockInterface],
});

mockGetVPC(mockVPC).as('getVPC');
mockGetSubnets(mockVPC.id, [mockSubnet]).as('getSubnets');
mockGetLinodeDetails(mockLinode.id, mockLinode).as('getLinode');
mockGetLinodeConfigs(mockLinode.id, [mockLinodeConfig]).as(
'getLinodeConfigs'
);
mockGetLinodeConfig({
config: mockLinodeConfig,
configId: mockLinodeConfig.id,
linodeId: mockLinode.id,
}).as('getLinodeConfig');

cy.visitWithLogin(`/vpcs/${mockVPC.id}`);
cy.findByLabelText(`expand ${mockSubnet.label} row`).click();
cy.wait('@getLinodeConfigs');
cy.wait('@getLinodeConfig');
cy.findByTestId(WARNING_ICON_UNRECOMMENDED_CONFIG).should('not.exist');
});

Expand All @@ -390,6 +411,7 @@ describe('VPC details page', () => {
const linodeRegion = chooseRegion({ capabilities: ['VPCs'] });

const mockInterfaceId = randomNumber();
const mockConfigId = randomNumber();
const mockLinode = linodeFactory.build({
id: randomNumber(),
label: randomLabel(),
Expand All @@ -403,7 +425,13 @@ describe('VPC details page', () => {
linodes: [
{
id: mockLinode.id,
interfaces: [{ active: true, id: mockInterfaceId }],
interfaces: [
{
active: true,
config_id: mockConfigId,
id: mockInterfaceId,
},
],
},
],
});
Expand All @@ -430,19 +458,22 @@ describe('VPC details page', () => {
});

const mockLinodeConfig = linodeConfigFactory.build({
id: mockConfigId,
interfaces: [mockInterface, mockPrimaryInterface],
});

mockGetVPC(mockVPC).as('getVPC');
mockGetSubnets(mockVPC.id, [mockSubnet]).as('getSubnets');
mockGetLinodeDetails(mockLinode.id, mockLinode).as('getLinode');
mockGetLinodeConfigs(mockLinode.id, [mockLinodeConfig]).as(
'getLinodeConfigs'
);
mockGetLinodeConfig({
config: mockLinodeConfig,
configId: mockLinodeConfig.id,
linodeId: mockLinode.id,
}).as('getLinodeConfig');

cy.visitWithLogin(`/vpcs/${mockVPC.id}`);
cy.findByLabelText(`expand ${mockSubnet.label} row`).click();
cy.wait('@getLinodeConfigs');
cy.wait('@getLinodeConfig');
cy.findByTestId(WARNING_ICON_UNRECOMMENDED_CONFIG).should('exist');
});
});
53 changes: 51 additions & 2 deletions packages/manager/cypress/support/intercepts/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

import { apiMatcher } from 'support/util/intercepts';
import { paginateResponse } from 'support/util/paginate';
import { Config } from '@linode/api-v4';
import { makeResponse } from 'support/util/response';

import type { Config, Interface } from '@linode/api-v4';

/**
* Intercepts GET request to fetch all configs for a given linode.
*
Expand Down Expand Up @@ -102,7 +103,7 @@ export const mockDeleteLinodeConfigInterface = (
* Mocks GET request to retrieve Linode configs.
*
* @param linodeId - ID of Linode for mocked request.
* @param configs - a list of Linode configswith which to mocked response.
* @param configs - a list of Linode configs with which to mocked response.
*
* @returns Cypress chainable.
*/
Expand All @@ -117,6 +118,54 @@ export const mockGetLinodeConfigs = (
);
};

/**
* Mocks GET request to retrieve a Linode Config
*
* @param linodeId - ID of Linode for mocked request.
* @param configId - ID of Config for mocked request.
* @param config - the config with which to mocked response.
*
* @returns Cypress chainable.
*/
export const mockGetLinodeConfig = (inputs: {
config: Config;
configId: number;
linodeId: number;
}): Cypress.Chainable<null> => {
const { config, configId, linodeId } = inputs;
return cy.intercept(
'GET',
apiMatcher(`linode/instances/${linodeId}/configs/${configId}`),
config
);
};

/**
* Mocks GET request to retrieve an interface of a Linode config
*
* @param linodeId - ID of Linode for mocked request.
* @param configId - ID of Config for mocked request.
* @param linodeId - ID of Config Interface for mocked request.
* @param configInterface - the interface with which to mocked response.
*
* @returns Cypress chainable.
*/
export const mockGetLinodeConfigInterface = (inputs: {
configId: number;
configInterface: Interface;
interfaceId: number;
linodeId: number;
}): Cypress.Chainable<null> => {
const { configId, configInterface, interfaceId, linodeId } = inputs;
return cy.intercept(
'GET',
apiMatcher(
`linode/instances/${linodeId}/configs/${configId}/interfaces/${interfaceId}`
),
configInterface
);
};

/**
* Mocks PUT request to update a linode config.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const VPCInterfaceDetailsContent = (props: VPCInterfaceData) => {
<MaskableText
isToggleable
key={range.range}
text={`${range.range} (Range)'}`}
text={`${range.range} (Range)`}
/>
))}
</>
Expand Down
Loading