Skip to content

Commit aadf5f6

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 aadf5f6

8 files changed

Lines changed: 15 additions & 113 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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
test,
33
expect,
44
cleanupTemplates,
5-
ensureValidToken,
65
randomName,
76
waitInPatch,
87
isInInventory,
@@ -12,7 +11,6 @@ import {
1211
} from 'test-utils';
1312
import { CONTENT_PROPAGATION_POLL } from '../testConstants';
1413
import { RHSMClient } from './helpers/rhsmClient';
15-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
1614
import { navigateToTemplates } from '../UI/helpers/navHelpers';
1715
import {
1816
closeGenericPopupsIfExist,
@@ -36,12 +34,7 @@ test.describe('Associated Template CRUD', () => {
3634
let hostname: string;
3735

3836
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-
});
37+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
4538
cleanup.add(() => regClient.Destroy('rhc'));
4639
});
4740

_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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
expect,
55
cleanupRepositories,
66
cleanupTemplates,
7-
ensureValidToken,
87
randomName,
98
waitWhileRepositoryIsPending,
109
} from 'test-utils';
@@ -18,7 +17,6 @@ import {
1817
} from '../testConstants';
1918
import { RHSMClient, refreshSubscriptionManager } from './helpers/rhsmClient';
2019
import { runCmd } from './helpers/helpers';
21-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
2220
import { navigateToRepositories, navigateToTemplates } from '../UI/helpers/navHelpers';
2321
import {
2422
closeGenericPopupsIfExist,
@@ -41,13 +39,8 @@ test.describe('Install Upload Repo Content', () => {
4139
const regClient = new RHSMClient(hostname);
4240

4341
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-
});
42+
await cleanup.runAndAdd(() => cleanupRepositories(client, uploadRepoNamePrefix));
43+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
5144
cleanup.add(() => regClient.Destroy('rhc'));
5245
});
5346

_playwright-tests/Integration/PulpFixtureRepoIntrospection.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ test.describe('Pulp Fixture Repository Introspection', () => {
8282

8383
await test.step('Validate existing pulp repositories count', async () => {
8484
expect(pulpReposResponse.data).toBeDefined();
85-
expect(existingPulpRepos.length).toBe(36);
85+
expect(existingPulpRepos).toHaveLength(36);
8686
});
8787

8888
await test.step('Check that repositories are introspected and have valid status', async () => {

_playwright-tests/Integration/RegisterAndAssignSystemViaAPI.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
LONG_TEST_TIMEOUT_MS,
114
RHSM_RHCD_WAIT,
@@ -18,25 +11,18 @@ import {
1811
waitForValidStatus,
1912
} from '../UI/helpers/helpers';
2013
import { RHSMClient, waitForRhcdActive, refreshSubscriptionManager } from './helpers/rhsmClient';
21-
import { createApiConfigWithDynamicToken } from './helpers/apiHelpers';
2214

2315
const templateNamePrefix = 'use_template_dialog_test';
2416
const regClient = new RHSMClient(`RHSMClientTest-${randomName()}`);
2517

2618
test.describe('Register and assign template to systems via API', () => {
2719
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
2920
test.setTimeout(LONG_TEST_TIMEOUT_MS);
3021

3122
const templateName = `${templateNamePrefix}-${randomName()}`;
3223

3324
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-
});
25+
await cleanup.runAndAdd(() => cleanupTemplates(client, templateNamePrefix));
4026
cleanup.add(() => regClient.Destroy('rhc'));
4127
});
4228

_playwright-tests/Integration/UseSnapshotConfig.spec.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
import { closeGenericPopupsIfExist, waitForValidStatus } from '../UI/helpers/helpers';
22
import { navigateToRepositories, navigateToSnapshotsOfRepository } from '../UI/helpers/navHelpers';
3-
import { cleanupRepositories, ensureValidToken, randomName, test, expect } from 'test-utils';
3+
import { cleanupRepositories, randomName, test, expect } from 'test-utils';
44
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)