Skip to content

Commit

Permalink
Everest-1642 | fix restore db version (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-silva authored Dec 20, 2024
1 parent c0a70d5 commit c4374a5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test.describe('DB Cluster Restore to the new cluster', () => {
await createDbClusterFn(request, {
dbName: dbClusterName,
dbType: 'mysql',
dbVersion: '8.0.36-28.1',
numberOfNodes: '1',
backup: {
enabled: true,
Expand Down Expand Up @@ -62,6 +63,31 @@ test.describe('DB Cluster Restore to the new cluster', () => {
});

test('DB cluster detail restore action', async ({ page }) => {
await page.route(
'/v1/namespaces/**/database-clusters/**/backups',
async (route) => {
await route.fulfill({
json: {
items: [
{
metadata: {
name: 'backup-1',
},
spec: {
dbClusterName,
backupStorageName: getBucketNamespacesMap()[0][0],
},
status: {
state: 'Succeeded',
created: '2024-12-20T11:57:41Z',
completed: '2024-12-20T11:58:07Z',
},
},
],
},
});
}
);
await findDbAndClickRow(page, dbClusterName);
const actionButton = page.getByTestId('actions-button');
await actionButton.click();
Expand All @@ -76,5 +102,15 @@ test.describe('DB Cluster Restore to the new cluster', () => {
.getByTestId('select-backup-name-button')
.getByText(Messages.selectBackup)
).toBeVisible();
await page.getByTestId('select-backup-name-button').click();
await page.getByText('backup-1').click();
await page.getByText('Create', { exact: true }).click();
await expect(
page.getByText('Basic information', { exact: true })
).toBeVisible();
await expect(page.getByTestId('select-input-db-version')).toBeDisabled();
await expect(page.getByTestId('select-input-db-version')).toHaveValue(
'8.0.36-28.1'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ interface DbVersionProps {
selectInputProps?: Omit<SelectInputProps, 'name'>;
availableVersions: DbEngineTool[] | undefined;
}
export const DbVersion = ({ availableVersions }: DbVersionProps) => {
export const DbVersion = ({
availableVersions,
selectInputProps,
}: DbVersionProps) => {
return (
<SelectInput name={DBVersionFields.dbVersion} label={Messages.dbVersion}>
<SelectInput
name={DBVersionFields.dbVersion}
label={Messages.dbVersion}
{...selectInputProps}
>
{availableVersions &&
availableVersions.map((version) => (
<MenuItem value={version.version} key={version.version}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const FirstStep = ({ loadingDefaultsForEdition }: StepProps) => {
.filter((item) => item.namespace === dbNamespace)
.map((item) => item.dbEngine);
const dbEngine = dbEnginesArray ? dbEnginesArray[0] : undefined;
if (mode === 'edit' && dbEngine) {
if (mode !== 'new' && dbEngine) {
const validVersions = filterAvailableDbVersionsForDbEngineEdition(
dbEngine,
defaultDbVersion
Expand Down

0 comments on commit c4374a5

Please sign in to comment.