From 89304c52c93bf556fc2f0775150550752e3e8ca3 Mon Sep 17 00:00:00 2001 From: Julien Adamek Date: Mon, 26 Feb 2024 10:45:06 +0100 Subject: [PATCH] ci/ui: add test for dhcp hostname --- .../latest/e2e/unit_tests/machine_inventory.spec.ts | 7 +++++-- .../latest/fixtures/custom_cloud-config_with_reset.yaml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/cypress/latest/e2e/unit_tests/machine_inventory.spec.ts b/tests/cypress/latest/e2e/unit_tests/machine_inventory.spec.ts index 1744add71..5241e525d 100644 --- a/tests/cypress/latest/e2e/unit_tests/machine_inventory.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/machine_inventory.spec.ts @@ -29,6 +29,9 @@ describe('Machine inventory testing', () => { const proxy = "http://172.17.0.1:3128" const uiAccount = Cypress.env('ui_account'); const uiPassword = "rancherpassword" + let hostname = "" + // Test if machine inventory uses hostname given by DHCP + utils.isK8sVersion("k3s") && utils.isCypressTag("main") ? hostname=('node-001') : hostname=('my-machine'); beforeEach(() => { (uiAccount == "user") ? cy.login(elementalUser, uiPassword) : cy.login(); @@ -50,7 +53,7 @@ describe('Machine inventory testing', () => { .contains('Active') .should('exist'); cy.getBySel('sortable-cell-0-1') - .contains('my-machine') + .contains(hostname) .should('exist'); }) ); @@ -58,7 +61,7 @@ describe('Machine inventory testing', () => { qase(29, it('Check we can see our embedded hardware labels', () => { cy.clickNavMenu(["Inventory of Machines"]); - cy.contains('my-machine') + cy.contains(hostname) .click() cy.checkMachInvLabel('machine-registration', 'myInvLabel1', 'myInvLabelValue1', true); for (const key in hwLabels) { diff --git a/tests/cypress/latest/fixtures/custom_cloud-config_with_reset.yaml b/tests/cypress/latest/fixtures/custom_cloud-config_with_reset.yaml index f0e0f55c8..cb75b913b 100644 --- a/tests/cypress/latest/fixtures/custom_cloud-config_with_reset.yaml +++ b/tests/cypress/latest/fixtures/custom_cloud-config_with_reset.yaml @@ -15,4 +15,4 @@ config: reset-oem: true power-off: false reboot: true -machineName: my-machine +machineName: ${System Data/Runtime/Hostname}