Skip to content

Commit

Permalink
EVEREST-1542 - Extend upgrade tests (#956)
Browse files Browse the repository at this point in the history
* EVEREST-1542 - Modify upgrade test

* Create functions for getting and updating DB cluster with API

* Fix function naming

* Update upgrade/post-upgrade.e2e.ts test

* chore: lint/format

---------

Co-authored-by: tplavcic <[email protected]>
Co-authored-by: Fábio Silva <[email protected]>
  • Loading branch information
3 people authored Dec 22, 2024
1 parent c4374a5 commit 75d5bda
Show file tree
Hide file tree
Showing 12 changed files with 437 additions and 153 deletions.
1 change: 1 addition & 0 deletions ui/apps/everest/.e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const minute = 60 * second;

export enum TIMEOUTS {
TenSeconds = 10 * second,
FifteenSeconds = 15 * second,
ThirtySeconds = 30 * second,
OneMinute = minute,
ThreeMinutes = 3 * minute,
Expand Down
1 change: 1 addition & 0 deletions ui/apps/everest/.e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default defineConfig({
channel: 'chrome',
storageState: STORAGE_STATE_FILE,
video: 'retain-on-failure',
actionTimeout: 10000,
},
testDir: 'upgrade',
dependencies: ['setup'],
Expand Down
24 changes: 6 additions & 18 deletions ui/apps/everest/.e2e/release/demand-backup.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import {
waitForDelete,
findRowAndClickActions,
} from '@e2e/utils/table';
import { checkError } from '@e2e/utils/generic';
import {
deleteMonitoringInstance,
listMonitoringInstances,
} from '@e2e/utils/monitoring-instance';
import { clickOnDemandBackup } from '@e2e/pr/db-cluster-details/utils';
import { prepareTestDB, dropTestDB, queryTestDB } from '@e2e/utils/db-cmd-line';
import { getDbClusterAPI } from '@e2e/utils/db-cluster';

const {
MONITORING_URL,
Expand Down Expand Up @@ -181,25 +181,13 @@ test.describe.configure({ retries: 0 });
});

await test.step('Check db cluster k8s object options', async () => {
const response = await request.get(
`/v1/namespaces/${namespace}/database-clusters`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);

await checkError(response);

// TODO: replace with correct payload typings from GET DB Clusters
const { items: clusters } = await response.json();

const addedCluster = clusters.find(
(cluster) => cluster.metadata.name === clusterName
const addedCluster = await getDbClusterAPI(
clusterName,
EVEREST_CI_NAMESPACES.EVEREST_UI,
request,
token
);

expect(addedCluster).not.toBeUndefined();
expect(addedCluster?.spec.engine.type).toBe(db);
expect(addedCluster?.spec.engine.replicas).toBe(size);
expect(['600m', '0.6']).toContain(
Expand Down
23 changes: 6 additions & 17 deletions ui/apps/everest/.e2e/release/init-deploy.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import {
} from '@e2e/utils/db-wizard';
import { EVEREST_CI_NAMESPACES } from '@e2e/constants';
import { waitForStatus, waitForDelete } from '@e2e/utils/table';
import { checkError } from '@e2e/utils/generic';
import {
deleteMonitoringInstance,
listMonitoringInstances,
} from '@e2e/utils/monitoring-instance';
import { getDbClusterAPI } from '@e2e/utils/db-cluster';

const {
MONITORING_URL,
Expand Down Expand Up @@ -183,24 +183,13 @@ test.describe.configure({ retries: 0 });
});

await test.step('Check db cluster k8s object options', async () => {
const response = await request.get(
`/v1/namespaces/${namespace}/database-clusters`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);
await checkError(response);

// TODO: replace with correct payload typings from GET DB Clusters
const { items: clusters } = await response.json();

const addedCluster = clusters.find(
(cluster) => cluster.metadata.name === clusterName
const addedCluster = await getDbClusterAPI(
clusterName,
EVEREST_CI_NAMESPACES.EVEREST_UI,
request,
token
);

expect(addedCluster).not.toBeUndefined();
expect(addedCluster?.spec.engine.type).toBe(db);
expect(addedCluster?.spec.engine.replicas).toBe(size);
expect(['600m', '0.6']).toContain(
Expand Down
51 changes: 19 additions & 32 deletions ui/apps/everest/.e2e/release/pitr.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
waitForDelete,
findRowAndClickActions,
} from '@e2e/utils/table';
import { checkError } from '@e2e/utils/generic';
import {
deleteMonitoringInstance,
listMonitoringInstances,
Expand All @@ -50,6 +49,7 @@ import {
pgInsertDummyTestDB,
} from '@e2e/utils/db-cmd-line';
import { addFirstScheduleInDBWizard } from '@e2e/pr/db-cluster/db-wizard/db-wizard-utils';
import { getDbClusterAPI, updateDbClusterAPI } from '@e2e/utils/db-cluster';

const {
MONITORING_URL,
Expand Down Expand Up @@ -253,45 +253,32 @@ test.describe.configure({ retries: 0 });
if (db !== 'psmdb') {
return;
}
let psmdbCluster = await request.get(
`/v1/namespaces/${namespace}/database-clusters/${clusterName}`
);

await checkError(psmdbCluster);
const psmdbPayload = await psmdbCluster.json();

psmdbPayload.spec.backup.pitr.uploadIntervalSec = 60;

const updatedPSMDBCluster = await request.put(
`/v1/namespaces/${namespace}/database-clusters/${clusterName}`,
{
data: psmdbPayload,
}
const psmdbCluster = await getDbClusterAPI(
clusterName,
EVEREST_CI_NAMESPACES.EVEREST_UI,
request,
token
);
psmdbCluster.spec.backup.pitr.uploadIntervalSec = 60;
await updateDbClusterAPI(
clusterName,
EVEREST_CI_NAMESPACES.EVEREST_UI,
psmdbCluster,
request,
token
);

await checkError(updatedPSMDBCluster);
});

await test.step('Check db cluster k8s object options', async () => {
const response = await request.get(
`/v1/namespaces/${namespace}/database-clusters`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);
await checkError(response);

// TODO: replace with correct payload typings from GET DB Clusters
const { items: clusters } = await response.json();

const addedCluster = clusters.find(
(cluster) => cluster.metadata.name === clusterName
const addedCluster = await getDbClusterAPI(
clusterName,
EVEREST_CI_NAMESPACES.EVEREST_UI,
request,
token
);

expect(addedCluster?.spec.backup.pitr.enabled).toBe(true);
expect(addedCluster).not.toBeUndefined();
expect(addedCluster?.spec.engine.type).toBe(db);
expect(addedCluster?.spec.engine.replicas).toBe(size);
expect(['600m', '0.6']).toContain(
Expand Down
24 changes: 6 additions & 18 deletions ui/apps/everest/.e2e/release/scheduled-backup.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ import {
waitForDelete,
findRowAndClickActions,
} from '@e2e/utils/table';
import { checkError } from '@e2e/utils/generic';
import {
deleteMonitoringInstance,
listMonitoringInstances,
} from '@e2e/utils/monitoring-instance';
import { clickCreateSchedule } from '@e2e/pr/db-cluster-details/utils';
import { prepareTestDB, dropTestDB, queryTestDB } from '@e2e/utils/db-cmd-line';
import { getDbClusterAPI } from '@e2e/utils/db-cluster';

const {
MONITORING_URL,
Expand Down Expand Up @@ -188,25 +188,13 @@ function getNextScheduleMinute(incrementMinutes: number): string {
});

await test.step('Check db cluster k8s object options', async () => {
const response = await request.get(
`/v1/namespaces/${namespace}/database-clusters`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);

await checkError(response);

// TODO: replace with correct payload typings from GET DB Clusters
const { items: clusters } = await response.json();

const addedCluster = clusters.find(
(cluster) => cluster.metadata.name === clusterName
const addedCluster = await getDbClusterAPI(
clusterName,
EVEREST_CI_NAMESPACES.EVEREST_UI,
request,
token
);

expect(addedCluster).not.toBeUndefined();
expect(addedCluster?.spec.engine.type).toBe(db);
expect(addedCluster?.spec.engine.replicas).toBe(size);
expect(['600m', '0.6']).toContain(
Expand Down
Loading

0 comments on commit 75d5bda

Please sign in to comment.