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
1 change: 0 additions & 1 deletion tests/suites/tenant/diagnostics/Diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ export class Diagnostics {
await this.cpuCard.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
await this.storageCard.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
await this.memoryCard.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
await this.healthcheckCard.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});
return true;
}

Expand Down
98 changes: 97 additions & 1 deletion tests/suites/tenant/diagnostics/tabs/info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,101 @@ test.describe('Diagnostics Info tab', async () => {
expect(utilization.memory.usage).toBeTruthy();
});

test('Info tab shows healthcheck status', async ({page}) => {
test('Info tab shows healthcheck status when there are issues', async ({page}) => {
// Mock healthcheck API to return DEGRADED status with issues
await page.route(`**/viewer/json/healthcheck?*`, async (route) => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
self_check_result: 'DEGRADED',
issue_log: [
{
id: 'issue-1',
status: 'YELLOW',
message: 'Some degraded component',
location: {
database: {
name: tenantName,
},
},
},
],
}),
});
});

const pageQueryParams = {
schema: tenantName,
database: tenantName,
tenantPage: 'diagnostics',
};
const tenantPage = new TenantPage(page);
await tenantPage.goto(pageQueryParams);

const diagnostics = new Diagnostics(page);
await diagnostics.clickTab(DiagnosticsTab.Info);

// Healthcheck card should be visible when there are issues
const status = await diagnostics.getHealthcheckStatus();
expect(status).toBeTruthy();

// Check for degraded status class
const isDegraded = await diagnostics.hasHealthcheckStatusClass(
'ydb-healthcheck-preview__icon_degraded',
);
expect(isDegraded).toBe(true);
});

test('Info tab hides healthcheck status when status is GOOD with no issues', async ({page}) => {
// Mock healthcheck API to return GOOD status with no issues
await page.route(`**/viewer/json/healthcheck?*`, async (route) => {
await route.fulfill({
json: {
self_check_result: 'GOOD',
issue_log: [],
},
});
});

const pageQueryParams = {
schema: tenantName,
database: tenantName,
tenantPage: 'diagnostics',
};
const tenantPage = new TenantPage(page);
await tenantPage.goto(pageQueryParams);

const diagnostics = new Diagnostics(page);
await diagnostics.clickTab(DiagnosticsTab.Info);

// Healthcheck card should not be visible when status is GOOD with no issues
const healthcheckCard = page.locator('.ydb-healthcheck-preview');
await expect(healthcheckCard).toHaveCount(0);
});

test('Info tab shows healthcheck status when status is GOOD but has issues', async ({page}) => {
// Mock healthcheck API to return GOOD status but with issues (edge case)
await page.route(`**/viewer/json/healthcheck?*`, async (route) => {
await route.fulfill({
json: {
self_check_result: 'GOOD',
issue_log: [
{
id: 'issue-1',
status: 'GREEN',
message: 'Some informational issue',
location: {
database: {
name: tenantName,
},
},
},
],
},
});
});

const pageQueryParams = {
schema: tenantName,
database: tenantName,
Expand All @@ -53,9 +147,11 @@ test.describe('Diagnostics Info tab', async () => {
const diagnostics = new Diagnostics(page);
await diagnostics.clickTab(DiagnosticsTab.Info);

// Healthcheck card should be visible when there are issues, even if status is GOOD
const status = await diagnostics.getHealthcheckStatus();
expect(status).toBeTruthy();

// Check for good status class
const isGood = await diagnostics.hasHealthcheckStatusClass(
'ydb-healthcheck-preview__icon_good',
);
Expand Down
Loading