Skip to content
Open
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
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13539-tests-1775850586793.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@linode/manager': Tests
---

Mock `databaseResizeGenerationalPlans` feature flag to false for resize-database.spec.ts ([#13539](https://github.com/linode/manager/pull/13539))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Generational plans changes for Databases ([#13539](https://github.com/linode/manager/pull/13539))
35 changes: 20 additions & 15 deletions packages/manager/cypress/e2e/core/databases/resize-database.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/**
* @file DBaaS integration tests for resize operations.
*/
import {
ClusterSize,
DatabaseStatus,
RegionAvailability,
} from '@linode/api-v4';
import { accountFactory } from '@src/factories';
import {
databaseConfigurationsResize,
Expand All @@ -20,13 +12,22 @@ import {
mockResize,
mockResizeProvisioningDatabase,
} from 'support/intercepts/databases';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { mockGetRegionAvailability } from 'support/intercepts/regions';
import { ui } from 'support/ui';
import { randomIp, randomNumber, randomString } from 'support/util/random';
import { getRegionById } from 'support/util/regions';

import { databaseFactory } from 'src/factories/databases';

/**
* @file DBaaS integration tests for resize operations.
*/
import type {
ClusterSize,
DatabaseStatus,
RegionAvailability,
} from '@linode/api-v4';
import type { DatabaseClusterConfiguration } from 'support/constants/databases';

/**
Expand Down Expand Up @@ -63,16 +64,20 @@ const resizeDatabase = (initialLabel: string) => {
* @param clusterSize - Database Cluster Size
*/
const getNodes = (clusterSize: number) => {
const nodes =
clusterSize == 1
? 'Primary (1 Node)'
: clusterSize == 2
? 'Primary (+1 Node)'
: 'Primary (+2 Nodes)';
return nodes;
return clusterSize === 1
? 'Primary (1 Node)'
: clusterSize === 2
? 'Primary (+1 Node)'
: 'Primary (+2 Nodes)';
};

describe('Resizing existing clusters', () => {
beforeEach(() => {
mockAppendFeatureFlags({
databaseResizeGenerationalPlans: false,
});
});

databaseConfigurationsResize.forEach(
(configuration: DatabaseClusterConfiguration) => {
describe(`Resizes a ${configuration.linodeType} ${configuration.engine} v${configuration.version}.x ${configuration.clusterSize}-node cluster`, () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/manager/src/dev-tools/FeatureFlagTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const options: { flag: keyof Flags; label: string }[] = [
{ flag: 'supportTicketSeverity', label: 'Support Ticket Severity' },
{ flag: 'dbaasV2', label: 'Databases V2 Beta' },
{ flag: 'dbaasV2MonitorMetrics', label: 'Databases V2 Monitor' },
{
flag: 'databaseResizeGenerationalPlans',
label: 'Database Resize Generational Plans',
},
{ flag: 'databasePgBouncer', label: 'Database PgBouncer' },
{ flag: 'databaseResize', label: 'Database Resize' },
{ flag: 'databaseAdvancedConfig', label: 'Database Advanced Config' },
Expand Down
1 change: 1 addition & 0 deletions packages/manager/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export interface Flags {
databasePgBouncer: boolean;
databasePremium: boolean;
databaseResize: boolean;
databaseResizeGenerationalPlans: boolean;
databaseRestrictPlanResize: boolean;
databases: boolean;
databaseVpc: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
import { ErrorMessage } from 'src/components/ErrorMessage';
import { LandingHeader } from 'src/components/LandingHeader';
import { getRestrictedResourceText } from 'src/features/Account/utils';
import { getIsLimitedAvailability } from 'src/features/components/PlansPanel/utils';
import {
getIsLimitedAvailability,
useShouldDisablePremiumPlansTab,
} from 'src/features/components/PlansPanel/utils';
import { DatabaseClusterData } from 'src/features/Databases/DatabaseCreate/DatabaseClusterData';
import {
StyledBtnCtn,
Expand All @@ -35,11 +38,13 @@

import { DatabaseCreateAccessControls } from './DatabaseCreateAccessControls';
import { DatabaseCreateNetworkingConfiguration } from './DatabaseCreateNetworkingConfiguration';
// import dbtypesData from './dbtypes.json';

Check warning on line 41 in packages/manager/src/features/Databases/DatabaseCreate/DatabaseCreate.tsx

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Remove this commented out code. Raw Output: {"ruleId":"sonarjs/no-commented-code","severity":1,"message":"Remove this commented out code.","line":41,"column":1,"nodeType":null,"messageId":"commentedCode","endLine":41,"endColumn":45,"suggestions":[{"messageId":"commentedCodeFix","fix":{"range":[1964,2008],"text":""},"desc":"Remove this commented out code"}]}

import type { AccessProps } from './DatabaseCreateAccessControls';
import type {
ClusterSize,
CreateDatabasePayload,
// DatabaseType,
Engine,
PrivateNetwork,
VPC,
Expand Down Expand Up @@ -74,12 +79,14 @@

const {
data: dbtypes,
error: typesError,
isLoading: typesLoading,
// error: typesError,
// isLoading: typesLoading,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need typesError and typesLoading?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these were just removed for the mock data. Planning to add the checks these were used in back before merging the pull request. See related comment for context.

} = useDatabaseTypesQuery({
platform: 'rdbms-default',
});

// const dbtypes = dbtypesData.data as DatabaseType[];

Check warning on line 88 in packages/manager/src/features/Databases/DatabaseCreate/DatabaseCreate.tsx

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Remove this commented out code. Raw Output: {"ruleId":"sonarjs/no-commented-code","severity":1,"message":"Remove this commented out code.","line":88,"column":3,"nodeType":null,"messageId":"commentedCode","endLine":88,"endColumn":57,"suggestions":[{"messageId":"commentedCodeFix","fix":{"range":[3193,3247],"text":""},"desc":"Remove this commented out code"}]}
Copy link
Copy Markdown
Contributor

@smans-akamai smans-akamai Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: As mentioned in the description, the dbtypes json file that mocks the new response in Database Create and Resize will be removed along with references to it in the code like the line above prior to merging.


const flags = useFlags();
const isVPCEnabled = flags.databaseVpc;

Expand Down Expand Up @@ -252,11 +259,15 @@
}
};

if (regionsLoading || !regionsData || enginesLoading || typesLoading) {
const shouldDisablePremiumPlansTab = useShouldDisablePremiumPlansTab({
types: dbtypes,
});

if (regionsLoading || !regionsData || enginesLoading) {
return <CircleProgress />;
}

if (regionsError || typesError || enginesError) {
if (regionsError || enginesError) {
return <ErrorState errorText="An unexpected error occurred." />;
}

Expand Down Expand Up @@ -312,6 +323,9 @@
<StyledPlansPanel
data-qa-select-plan
disabled={isRestricted}
disabledTabs={
shouldDisablePremiumPlansTab ? ['premium'] : undefined
}
error={fieldState.error?.message}
flow="database"
handleTabChange={handleTabChange}
Expand All @@ -321,6 +335,11 @@
regionsData={regionsData}
selectedId={field.value}
selectedRegionID={region}
tabDisabledMessage={
shouldDisablePremiumPlansTab
? 'Premium CPUs are now called G7 Dedicated plans.'
: undefined
}
types={displayTypes}
/>
)}
Expand Down
Loading
Loading