Skip to content

Commit

Permalink
feat: add azure support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonemms committed Jan 13, 2025
1 parent e0bb164 commit 14b40d1
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CLUSTER_DOMAIN=
PASSWORD=
USERNAME=
RETRY_DELAY=20s
CLOUD_PROVIDER= aws| civo
CLOUD_PROVIDER= aws|azure|civo
MAX_TIME_TO_WAIT=5m
RETRIES_RUN_MODE=3
RETRIES_OPEN_MODE=0
Expand Down
105 changes: 105 additions & 0 deletions cypress/e2e/create/physical-cluster.azure.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import ms from "ms";

import { Account } from "../../../types/accouts";

import { fillOutForm } from "../../utils";

const CLUSTER_NAME = Cypress.env("CLUSTER_NAME");
const isAzure = Cypress.env("CLOUD_PROVIDER") === "azure";
const MAX_TIME_TO_WAIT = Cypress.env("MAX_TIME_TO_WAIT");

describe("Test to validate physical cluster creation on Azure", () => {
beforeEach(function () {
if (!isAzure) {
cy.log("This test is only for Azure");

this.skip();
}
});

beforeEach(() => {
const username = Cypress.env("USERNAME");
const password = Cypress.env("PASSWORD");

cy.login(username, password);
});

it("should create a physical cluster", () => {
cy.visit("/");
cy.findByRole("button", { name: /add workload cluster/i }).as("button");

cy.request("GET", "/api/proxy?url=%2Fcloud-account").then(
({ status, body }) => {
expect(status).to.eq(200);

const { cloud_accounts: cloudAccounts } = body;
cy.wrap(cloudAccounts as Account[]).as("accounts");
}
);

cy.get("@accounts").then((accounts) => {
const cloudAccounts = accounts as unknown as Account[];
expect(cloudAccounts).to.be.an("array");
expect(cloudAccounts).to.have.length.greaterThan(0);

const defaultAccount = cloudAccounts.find(
(account) => account.name === "default"
);

expect(defaultAccount).to.exist;
});

cy.get("@button").click();

fillOutForm({
name: CLUSTER_NAME,
region: /uksouth/i,
intanceSize: /Standard_D2s_v4/i,
});

cy.findByRole("button", {
name: /create cluster/i,
}).click();

cy.wait(2000);

cy.findByRole("heading", { name: new RegExp(CLUSTER_NAME, "i") }).should(
"exist"
);
cy.contains("Provisioning").should("exist");
});

it("should validate the cluster is provisioning", () => {
cy.visit("/");

cy.goClusters();

cy.findAllByRole("button", { name: new RegExp(CLUSTER_NAME, "i") })
.eq(0)
.as("clusterProvisioningButton");

cy.get("@clusterProvisioningButton").should("exist");

cy.get("@clusterProvisioningButton").within(() => {
cy.findByText(/provisioning/i).should("exist");
});
});

it("should validate the cluster is provisioned", { retries: 3 }, () => {
cy.visit("/");

cy.goClusters();

cy.findAllByRole("button", { name: new RegExp(CLUSTER_NAME, "i") })
.eq(0)
.as("clusterProvisionedButton");

cy.get("@clusterProvisionedButton").should("exist");

cy.get("@clusterProvisionedButton").within(() => {
cy.findByText(/provisioned/i, {
timeout: Number(ms(MAX_TIME_TO_WAIT)),
}).should("exist");
});
});
});

0 comments on commit 14b40d1

Please sign in to comment.