Skip to content

Commit c3a8d86

Browse files
committed
test: remove no longer needed custom configs
These custom dynamic configs aren't going to be needed after client changes done in "test-utils", they will be dynamic by default.
1 parent a67b67d commit c3a8d86

7 files changed

Lines changed: 12 additions & 101 deletions

_playwright-tests/Integration/AssignTemplateToSystemUI.spec.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
test,
3-
expect,
4-
cleanupTemplates,
5-
ensureValidToken,
6-
randomName,
7-
waitInPatch,
8-
} from 'test-utils';
1+
import { test, expect, cleanupTemplates, randomName, waitInPatch } from 'test-utils';
92
import {
103
CONTENT_PROPAGATION_POLL,
114
DNF_COMMAND_TIMEOUT_MS,
@@ -22,7 +15,6 @@ import {
2215
getRowByNameOrUrl,
2316
getRowCellByHeader,
2417
} from '../UI/helpers/helpers';
25-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
2618

2719
test.describe('Assign Template to System via UI', () => {
2820
const templateNamePrefix = 'Template_test_for_system_assignment';
@@ -32,7 +24,6 @@ test.describe('Assign Template to System via UI', () => {
3224
client,
3325
cleanup,
3426
}) => {
35-
void client; // Pull in fixture so Undici fetch dispatcher is configured for dynamic API cleanup
3627
const templateName = `${templateNamePrefix}-${randomName()}`;
3728
const containerName = `RHSMClientTest-${randomName()}`;
3829
const regClient = new RHSMClient(containerName);
@@ -68,12 +59,7 @@ test.describe('Assign Template to System via UI', () => {
6859
});
6960

7061
await test.step('Create template', async () => {
71-
await cleanup.runAndAdd(async () => {
72-
await ensureValidToken(page, 'ADMIN_TOKEN.json', 5);
73-
const apiBasePath = process.env.BASE_URL + '/api/content-sources/v1';
74-
const cleanupClient = createApiConfigWithDynamicToken('ADMIN_TOKEN', apiBasePath);
75-
await cleanupTemplates(cleanupClient, templateNamePrefix);
76-
});
62+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
7763
cleanup.add(() => regClient.Destroy('rhc'));
7864

7965
await closeGenericPopupsIfExist(page);

_playwright-tests/Integration/AssociatedTemplateCRUD.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
} from 'test-utils';
1313
import { CONTENT_PROPAGATION_POLL } from '../testConstants';
1414
import { RHSMClient } from './helpers/rhsmClient';
15-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
1615
import { navigateToTemplates } from '../UI/helpers/navHelpers';
1716
import {
1817
closeGenericPopupsIfExist,
@@ -36,12 +35,7 @@ test.describe('Associated Template CRUD', () => {
3635
let hostname: string;
3736

3837
await test.step('Set up cleanup for templates and RHSM client', async () => {
39-
await cleanup.runAndAdd(async () => {
40-
await ensureValidToken(page, 'ADMIN_TOKEN.json', 5);
41-
const apiBasePath = process.env.BASE_URL + '/api/content-sources/v1';
42-
const cleanupClient = createApiConfigWithDynamicToken('ADMIN_TOKEN', apiBasePath);
43-
await cleanupTemplates(cleanupClient, templateNamePrefix);
44-
});
38+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
4539
cleanup.add(() => regClient.Destroy('rhc'));
4640
});
4741

_playwright-tests/Integration/CanUpdateSystemWithTemplate.spec.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
} from '../testConstants';
1919
import { RHSMClient, refreshSubscriptionManager, waitForRhcdActive } from './helpers/rhsmClient';
2020
import { runCmd } from './helpers/helpers';
21-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
2221
import { navigateToTemplates } from '../UI/helpers/navHelpers';
2322
import {
2423
closeGenericPopupsIfExist,
@@ -41,19 +40,13 @@ test.describe('Test System With Template', () => {
4140
});
4241

4342
test('Verify system updates with template', async ({ page, client, cleanup }) => {
44-
void client; // Pull in fixture so Undici fetch dispatcher is configured for dynamic API cleanup
4543
// Increase timeout for CI environment because template update tasks can take longer
4644
test.setTimeout(LONG_TEST_TIMEOUT_MS);
4745

4846
const HARepo = 'Red Hat Enterprise Linux 9 for x86_64 - High Availability';
4947

5048
await test.step('Add cleanup, delete any templates and template test repos that exist', async () => {
51-
await cleanup.runAndAdd(async () => {
52-
await ensureValidToken(page, 'LAYERED_REPO_TOKEN.json', 5);
53-
const apiBasePath = process.env.BASE_URL + '/api/content-sources/v1';
54-
const cleanupClient = createApiConfigWithDynamicToken('LAYERED_REPO_TOKEN', apiBasePath);
55-
await cleanupTemplates(cleanupClient, templateNamePrefix);
56-
});
49+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
5750
cleanup.add(() => regClient.Destroy('rhc'));
5851
});
5952

@@ -152,18 +145,13 @@ test.describe('Test System With Template', () => {
152145
await page.getByRole('button', { name: 'Next', exact: true }).click();
153146
await page.getByRole('button', { name: 'Confirm changes', exact: true }).click();
154147

155-
// Wait for the template update task to complete. Check the token validity before each poll
156-
// because the JWT can expire mid-test.
157-
const tokenBaseName = 'LAYERED_REPO_TOKEN';
158-
const apiBasePath = process.env.BASE_URL + '/api/content-sources/v1';
159-
const dynamicClient = createApiConfigWithDynamicToken(tokenBaseName, apiBasePath);
160148
await expect
161149
.poll(
162150
async () => {
163-
await ensureValidToken(page, `${tokenBaseName}.json`, 5);
164-
const templates = await new TemplatesApi(dynamicClient).listTemplates(<
165-
ListTemplatesRequest
166-
>{ name: templateName });
151+
await ensureValidToken(page, `LAYERED_REPO_TOKEN.json`, 5);
152+
const templates = await new TemplatesApi(client).listTemplates(<ListTemplatesRequest>{
153+
name: templateName,
154+
});
167155
const template = templates.data?.[0];
168156
const taskStatus = template?.lastUpdateTask?.status;
169157
const taskError = template?.lastUpdateTask?.error;

_playwright-tests/Integration/InstallUploadRepoContent.spec.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
} from '../testConstants';
1919
import { RHSMClient, refreshSubscriptionManager } from './helpers/rhsmClient';
2020
import { runCmd } from './helpers/helpers';
21-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
2221
import { navigateToRepositories, navigateToTemplates } from '../UI/helpers/navHelpers';
2322
import {
2423
closeGenericPopupsIfExist,
@@ -41,13 +40,8 @@ test.describe('Install Upload Repo Content', () => {
4140
const regClient = new RHSMClient(hostname);
4241

4342
await test.step('Set up cleanup for repositories, templates, and RHSM client', async () => {
44-
await cleanup.runAndAdd(async () => {
45-
await ensureValidToken(page, 'ADMIN_TOKEN.json', 5);
46-
const apiBasePath = process.env.BASE_URL + '/api/content-sources/v1';
47-
const cleanupClient = createApiConfigWithDynamicToken('ADMIN_TOKEN', apiBasePath);
48-
await cleanupRepositories(cleanupClient, uploadRepoNamePrefix);
49-
await cleanupTemplates(cleanupClient, templateNamePrefix);
50-
});
43+
await cleanup.runAndAdd(() => cleanupRepositories(client, uploadRepoNamePrefix));
44+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
5145
cleanup.add(() => regClient.Destroy('rhc'));
5246
});
5347

_playwright-tests/Integration/RegisterAndAssignSystemViaAPI.spec.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,18 @@ import {
1818
waitForValidStatus,
1919
} from '../UI/helpers/helpers';
2020
import { RHSMClient, waitForRhcdActive, refreshSubscriptionManager } from './helpers/rhsmClient';
21-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
2221

2322
const templateNamePrefix = 'use_template_dialog_test';
2423
const regClient = new RHSMClient(`RHSMClientTest-${randomName()}`);
2524

2625
test.describe('Register and assign template to systems via API', () => {
2726
test('Create template and assign to systems via API', async ({ page, client, cleanup }) => {
28-
void client; // Pull in fixture so Undici fetch dispatcher is configured for dynamic API cleanup
2927
test.setTimeout(LONG_TEST_TIMEOUT_MS);
3028

3129
const templateName = `${templateNamePrefix}-${randomName()}`;
3230

3331
await test.step('Set up cleanup for repositories, templates, and RHSM client', async () => {
34-
await cleanup.runAndAdd(async () => {
35-
await ensureValidToken(page, 'ADMIN_TOKEN.json', 5);
36-
const apiBasePath = process.env.BASE_URL + '/api/content-sources/v1';
37-
const cleanupClient = createApiConfigWithDynamicToken('ADMIN_TOKEN', apiBasePath);
38-
await cleanupTemplates(cleanupClient, templateNamePrefix);
39-
});
32+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
4033
cleanup.add(() => regClient.Destroy('rhc'));
4134
});
4235

_playwright-tests/Integration/UseSnapshotConfig.spec.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,19 @@ import { createCustomRepo } from '../UI/helpers/createRepositories';
55
import { refreshSubscriptionManager, RHSMClient, waitForRhcdActive } from './helpers/rhsmClient';
66
import fs from 'fs';
77
import { runCmd } from './helpers/helpers';
8-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
98

109
const repoNamePrefix = 'Snapshot_Config';
1110

1211
test.describe('Use Snapshot Config', () => {
1312
test('Use Snapshot Config', async ({ page, client, cleanup, unusedRepoUrl }) => {
14-
void client; // Pull in fixture so Undici fetch dispatcher is configured for dynamic API cleanup
1513
let repoName = '';
1614
let fileContent = '';
1715

1816
const regClient = new RHSMClient(`snapshot_config_test_${randomName()}`);
1917
repoName = `${repoNamePrefix}_${randomName()}`;
2018

2119
await test.step('Set up cleanup', async () => {
22-
await cleanup.runAndAdd(async () => {
23-
await ensureValidToken(page, 'ADMIN_TOKEN.json', 5);
24-
const apiBasePath = process.env.BASE_URL + '/api/content-sources/v1';
25-
const cleanupClient = createApiConfigWithDynamicToken('ADMIN_TOKEN', apiBasePath);
26-
await cleanupRepositories(cleanupClient, repoNamePrefix);
27-
});
20+
await cleanup.runAndAdd(() => cleanupRepositories(client, repoNamePrefix));
2821
await cleanup.runAndAdd(() => regClient.Destroy('rhc'));
2922
});
3023

_playwright-tests/Integration/helpers/apiHelpers.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)