Skip to content

Commit

Permalink
Handle namespaces more safely
Browse files Browse the repository at this point in the history
Signed-off-by: Dominika Zemanovicova <[email protected]>
  • Loading branch information
dzemanov committed Jan 7, 2025
1 parent c460534 commit dce6328
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test.describe("Test Kubernetes Actions plugin", () => {
let common: Common;
let uiHelper: UIhelper;
let kubeClient: KubeClient;
let namespace: string;

test.beforeAll(async ({ browser }, testInfo) => {
const page = (await setupBrowser(browser, testInfo)).page;
Expand All @@ -19,18 +20,20 @@ test.describe("Test Kubernetes Actions plugin", () => {
});

test("Creates kubernetes namespace", async () => {
const newNamespace = "test-kubernetes-actions-namespace";
namespace = `test-kubernetes-actions-${Date.now()}`;
await uiHelper.verifyHeading("Software Templates");
await uiHelper.clickBtnInCard("Create a kubernetes namespace", "Choose");
await uiHelper.waitForTitle("Create a kubernetes namespace", 2);

await uiHelper.fillTextInputByLabel("Namespace name", newNamespace);
await uiHelper.fillTextInputByLabel("Namespace name", namespace);
await uiHelper.fillTextInputByLabel("Url", process.env.K8S_CLUSTER_URL);
await uiHelper.fillTextInputByLabel("Token", process.env.K8S_CLUSTER_TOKEN);
await uiHelper.clickButton("Review");
await uiHelper.clickButton("Create");
await kubeClient.getNamespaceByName(namespace);
});

await kubeClient.getNamespaceByName(newNamespace);
await kubeClient.deleteNamespaceAndWait(newNamespace);
test.afterEach(async () => {
await kubeClient.deleteNamespaceAndWait(namespace);
});
});

0 comments on commit dce6328

Please sign in to comment.