Skip to content

Commit 92cd8d5

Browse files
authored
Fix playground tests, system out of storage errors (#3428)
* chore(tests): fixing model deletion logic Signed-off-by: Tibor Dancs <[email protected]> * chore(tests): removing playground-incompatible models Signed-off-by: Tibor Dancs <[email protected]> --------- Signed-off-by: Tibor Dancs <[email protected]>
1 parent 383bc58 commit 92cd8d5

File tree

2 files changed

+44
-14
lines changed

2 files changed

+44
-14
lines changed

tests/playwright/src/ai-lab-extension.spec.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -421,20 +421,17 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
421421
.toBe('RUNNING');
422422
});
423423

424-
test(`Delete model service for ${modelName}`, async () => {
424+
test(`Delete model service and model for ${modelName}`, async () => {
425425
test.setTimeout(150_000);
426-
const modelServicePage = await modelServiceDetailsPage.deleteService();
427-
await playExpect(modelServicePage.heading).toBeVisible({ timeout: 120_000 });
426+
await cleanupServices();
427+
await deleteAllModels();
428428
});
429429
});
430430
});
431431

432-
[
433-
'ibm-granite/granite-3.3-8b-instruct-GGUF',
434-
'instructlab/granite-7b-lab-GGUF',
435-
'instructlab/merlinite-7b-lab-GGUF',
436-
'TheBloke/Mistral-7B-Instruct-v0.2-GGUF',
437-
].forEach(modelName => {
432+
// Do not use non-instruct models in playground tests.
433+
// They break out of guilderails and fail the tests.
434+
['ibm-granite/granite-3.3-8b-instruct-GGUF', 'TheBloke/Mistral-7B-Instruct-v0.2-GGUF'].forEach(modelName => {
438435
test.describe.serial(`AI Lab playground creation and deletion for ${modelName}`, { tag: '@smoke' }, () => {
439436
let catalogPage: AILabCatalogPage;
440437
let playgroundsPage: AILabPlaygroundsPage;
@@ -515,7 +512,8 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
515512

516513
test.afterAll(`Cleaning up service model`, async () => {
517514
test.setTimeout(60_000);
518-
await cleanupServiceModels();
515+
await cleanupServices();
516+
await deleteAllModels();
519517
});
520518
});
521519
});
@@ -640,14 +638,15 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
640638

641639
await restartApp(appName);
642640
await stopAndDeleteApp(appName);
643-
await cleanupServiceModels();
641+
await cleanupServices();
644642
});
645643

646644
test.afterAll(`Ensure cleanup of "${appName}" app, related service, and images`, async ({ navigationBar }) => {
647645
test.setTimeout(150_000);
648646

649647
await stopAndDeleteApp(appName);
650-
await cleanupServiceModels();
648+
await cleanupServices();
649+
await deleteAllModels();
651650
await deleteUnusedImages(navigationBar);
652651
});
653652
});
@@ -716,7 +715,7 @@ test.describe.serial(`AI Lab extension installation and verification`, () => {
716715
});
717716
});
718717

719-
async function cleanupServiceModels(): Promise<void> {
718+
async function cleanupServices(): Promise<void> {
720719
try {
721720
const modelServicePage = await aiLabPage.navigationBar.openServices();
722721
await modelServicePage.waitForLoad();
@@ -727,6 +726,12 @@ async function cleanupServiceModels(): Promise<void> {
727726
}
728727
}
729728

729+
async function deleteAllModels(): Promise<void> {
730+
const modelCatalogPage = await aiLabPage.navigationBar.openCatalog();
731+
await modelCatalogPage.waitForLoad();
732+
await modelCatalogPage.deleteAllModels();
733+
}
734+
730735
async function restartApp(appName: string): Promise<void> {
731736
const aiRunningAppsPage = await aiLabPage.navigationBar.openRunningApps();
732737
const aiApp = await aiRunningAppsPage.getRowForApp(appName);

tests/playwright/src/model/ai-lab-catalog-page.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ export class AILabCatalogPage extends AILabBasePage {
5050
return undefined;
5151
}
5252

53+
async getModelNameByRow(row: Locator): Promise<string> {
54+
const modelNameCell = row.getByLabel('Model Name');
55+
const modelName = await modelNameCell.textContent();
56+
return modelName?.trim() ?? '';
57+
}
58+
5359
async downloadModel(modelName: string): Promise<void> {
5460
const modelRow = await this.getModelRowByName(modelName);
5561
if (!modelRow) {
@@ -75,16 +81,35 @@ export class AILabCatalogPage extends AILabBasePage {
7581
}
7682

7783
async deleteModel(modelName: string): Promise<void> {
84+
if (!modelName || modelName.trim() === '') {
85+
console.warn('Model name is empty, skipping deletion.');
86+
return;
87+
}
7888
const modelRow = await this.getModelRowByName(modelName);
7989
if (!modelRow) {
8090
throw new Error(`Model ${modelName} not found`);
8191
}
8292
const deleteButton = modelRow.getByRole('button', { name: 'Delete Model' });
83-
await playExpect(deleteButton).toBeEnabled();
93+
await playExpect.poll(async () => await deleteButton.isEnabled(), { timeout: 10_000 }).toBeTruthy();
8494
await deleteButton.focus();
8595
await deleteButton.click();
8696
await this.page.waitForTimeout(1_000);
8797
await handleConfirmationDialog(this.page, podmanAILabExtension.extensionName, true, 'Confirm');
98+
await playExpect.poll(async () => await this.isModelDownloaded(modelName), { timeout: 30_000 }).toBeFalsy();
99+
}
100+
101+
async deleteAllModels(): Promise<void> {
102+
const modelRows = await this.getAllModelRows();
103+
if (modelRows.length === 0) {
104+
return;
105+
}
106+
107+
for (const modelRow of modelRows) {
108+
const modelName = await this.getModelNameByRow(modelRow);
109+
if (await this.isModelDownloaded(modelName)) {
110+
await this.deleteModel(modelName);
111+
}
112+
}
88113
}
89114

90115
async isModelDownloaded(modelName: string): Promise<boolean> {

0 commit comments

Comments
 (0)