Skip to content

Commit

Permalink
EVEREST-1467 - Add option to select database and size for UI E2E test (
Browse files Browse the repository at this point in the history
…#682)

* EVEREST-1467 - Add option to select database and size for UI E2E test

* chore: lint/format

* Fix monitoring instance deletion

* chore: lint/format

---------

Co-authored-by: tplavcic <tplavcic@users.noreply.github.com>
  • Loading branch information
tplavcic and tplavcic committed Sep 18, 2024
1 parent 9ccd153 commit 180c291
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 9 deletions.
31 changes: 27 additions & 4 deletions ui/apps/everest/.e2e/release/demand-backup.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,19 @@ import {
findRowAndClickActions,
} from '../utils/table';
import { checkError } from '../utils/generic';
import { deleteMonitoringInstance } from '../utils/monitoring-instance';
import {
deleteMonitoringInstance,
listMonitoringInstances,
} from '../utils/monitoring-instance';
import { clickOnDemandBackup } from '../db-cluster-details/utils';

const { MONITORING_URL, MONITORING_USER, MONITORING_PASSWORD } = process.env;
const {
MONITORING_URL,
MONITORING_USER,
MONITORING_PASSWORD,
SELECT_DB,
SELECT_SIZE,
} = process.env;
let token: string;

test.describe.configure({ retries: 0 });
Expand All @@ -56,6 +65,11 @@ test.describe.configure({ retries: 0 });
tag: '@release',
},
() => {
test.skip(
() =>
(SELECT_DB !== db && !!SELECT_DB) ||
(SELECT_SIZE !== size.toString() && !!SELECT_SIZE)
);
test.describe.configure({ timeout: 720000 });

const clusterName = `${db}-${size}-dembkp`;
Expand All @@ -76,12 +90,21 @@ test.describe.configure({ retries: 0 });
});

test.afterAll(async ({ request }) => {
await deleteMonitoringInstance(
// we try to delete all monitoring instances because cluster creation expects that none exist
// (monitoring instance is added in the form where the warning that none exist is visible)
let monitoringInstances = await listMonitoringInstances(
request,
namespace,
monitoringName,
token
);
for (const instance of monitoringInstances) {
await deleteMonitoringInstance(
request,
namespace,
instance.name,
token
);
}
});

test(`Cluster creation with ${db} and size ${size}`, async ({
Expand Down
33 changes: 28 additions & 5 deletions ui/apps/everest/.e2e/release/init-deploy.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ import {
import { EVEREST_CI_NAMESPACES } from '../constants';
import { waitForStatus, waitForDelete } from '../utils/table';
import { checkError } from '../utils/generic';
import { deleteMonitoringInstance } from '../utils/monitoring-instance';

const { MONITORING_URL, MONITORING_USER, MONITORING_PASSWORD } = process.env;
import {
deleteMonitoringInstance,
listMonitoringInstances,
} from '../utils/monitoring-instance';

const {
MONITORING_URL,
MONITORING_USER,
MONITORING_PASSWORD,
SELECT_DB,
SELECT_SIZE,
} = process.env;
let token: string;

test.describe.configure({ retries: 0 });
Expand All @@ -55,6 +64,11 @@ test.describe.configure({ retries: 0 });
tag: '@release',
},
() => {
test.skip(
() =>
(SELECT_DB !== db && !!SELECT_DB) ||
(SELECT_SIZE !== size.toString() && !!SELECT_SIZE)
);
test.describe.configure({ timeout: 720000 });

const clusterName = `${db}-${size}-deploy`;
Expand All @@ -74,12 +88,21 @@ test.describe.configure({ retries: 0 });
});

test.afterAll(async ({ request }) => {
await deleteMonitoringInstance(
// we try to delete all monitoring instances because cluster creation expects that none exist
// (monitoring instance is added in the form where the warning that none exist is visible)
let monitoringInstances = await listMonitoringInstances(
request,
namespace,
monitoringName,
token
);
for (const instance of monitoringInstances) {
await deleteMonitoringInstance(
request,
namespace,
instance.name,
token
);
}
});

test(`Cluster creation with ${db} and size ${size}`, async ({
Expand Down
19 changes: 19 additions & 0 deletions ui/apps/everest/.e2e/utils/monitoring-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,22 @@ export const deleteMonitoringInstance = async (
);
expect(response.ok()).toBeTruthy();
};

export const listMonitoringInstances = async (
request: APIRequestContext,
namespace,
token: string
) => {
const response = await request.get(
`/v1/namespaces/${namespace}/monitoring-instances`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);
expect(response.ok()).toBeTruthy();

const responseBody = await response.json();
return responseBody;
};

0 comments on commit 180c291

Please sign in to comment.