Skip to content

Commit

Permalink
Fix image name contain upcase
Browse files Browse the repository at this point in the history
  • Loading branch information
n313893254 committed Jun 29, 2022
1 parent 656f2ef commit 6a49cbc
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 85 deletions.
12 changes: 6 additions & 6 deletions cypress/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export default defineConfig({
fixturesFolder: './fixtures',
viewportWidth: 1920,
viewportHeight: 1080,
numTestsKeptInMemory: 5,
defaultCommandTimeout: 30000,
requestTimeout: 20000,
responseTimeout: 20000,
numTestsKeptInMemory: 0,
defaultCommandTimeout: 60000,
requestTimeout: 30000,
responseTimeout: 30000,
env: {
NODE_ENV: 'production',
username: 'admin',
Expand All @@ -24,8 +24,8 @@ export default defineConfig({
],
},
image: {
name: 'openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso',
url: 'https://mirrors.bfsu.edu.cn/opensuse/distribution/leap/15.3/iso/openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso',
name: 'openSUSE-Leap-15.3-3-NET-x86_64.qcow2',
url: 'https://download.opensuse.org/pub/opensuse/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-15.3-OpenStack-Cloud-Current.qcow2',
},
nfsEndPoint: 'nfs://ip',
},
Expand Down
57 changes: 0 additions & 57 deletions cypress/cypress.json

This file was deleted.

2 changes: 1 addition & 1 deletion cypress/pageobjects/virtualmachine.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class VmsPage extends CruResourcePo {

const imageEnv = Cypress.env('image');

const name = imageEnv.name
const name = Cypress._.toLower(imageEnv.name)
const url = imageEnv.url
const imageFound = images.find((i:any) => i?.spec?.displayName === name)

Expand Down
21 changes: 7 additions & 14 deletions cypress/testcases/image/images.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import YAML from 'js-yaml'
import { VmsPage } from "@/pageobjects/virtualmachine.po";
import { ImagePage } from "@/pageobjects/image.po";
import { generateName } from '@/utils/utils';
Expand All @@ -10,7 +9,7 @@ const image = new ImagePage();
describe('Auto setup image from cypress environment', () => {
it('Auto setup image from cypress environment', () => {
const imageEnv = Cypress.env('image');
const IMAGE_NAME = imageEnv.name;
const IMAGE_NAME = Cypress._.toLower(imageEnv.name);
const IMAGE_URL = imageEnv.url;

const value = {
Expand All @@ -29,11 +28,7 @@ describe('Auto setup image from cypress environment', () => {
expect(res?.status, 'Check Image list').to.equal(200);
const images = res?.body?.data || []

const imageEnv = Cypress.env('image');

const name = imageEnv.name
const url = imageEnv.url
const imageFound = images.find((i:any) => i?.spec?.displayName === name)
const imageFound = images.find((i:any) => i?.spec?.displayName === IMAGE_NAME)

if (imageFound) {
return
Expand Down Expand Up @@ -116,7 +111,7 @@ describe('Create an image with valid image URL', () => {
* 1. Image state show as Failed
*/
describe('Create image with invalid URL', () => {
const IMAGE_NAME = 'auto-image-invalid-url-test';
const IMAGE_NAME = generateName('auto-image-invalid-url-test');

it('Create image with invalid URL', () => {
cy.login();
Expand Down Expand Up @@ -161,15 +156,14 @@ describe('Delete VM with exported image', () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
namespace,
}

vms.create(value);

// check VM state
vms.goToConfigDetail(VM_NAME);
vms.goToYamlDetail(VM_NAME);

// export IMAGE
image.exportImage(VM_NAME, IMAGE_NAME);
Expand Down Expand Up @@ -207,7 +201,7 @@ describe('Update image labels after deleting source VM', () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
namespace,
}

Expand All @@ -216,7 +210,6 @@ describe('Update image labels after deleting source VM', () => {

// check VM state
vms.goToConfigDetail(VM_NAME);
vms.goToYamlDetail(VM_NAME);

// export IMAGE
image.exportImage(VM_NAME, IMAGE_NAME);
Expand Down Expand Up @@ -346,12 +339,12 @@ describe('Create a ISO image via upload', () => {

// check VM state
vms.goToConfigDetail(VM_NAME);
vms.goToYamlDetail(VM_NAME);

// delete VM
vms.delete(namespace, VM_NAME)

// delete IMAGE
image.delete(IMAGE_NAME)
// TODO: Delete image should check volume is deleted
// image.delete(IMAGE_NAME)
});
});
6 changes: 3 additions & 3 deletions cypress/testcases/virtualmachines/advanced.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Create a new VM and add Enable USB tablet option', () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
usbTablet: true,
namespace: NAMESPACE,
}
Expand Down Expand Up @@ -74,7 +74,7 @@ describe("Create a new VM and add Install guest agent option", () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
guestAgent: true,
namespace: NAMESPACE,
}
Expand Down Expand Up @@ -106,7 +106,7 @@ describe("Verify Booting in EFI mode checkbox", () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
efiEnabled: true,
namespace: NAMESPACE,
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/testcases/virtualmachines/cpu-overcommit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Update Overcommit configuration', () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
namespace: NAMESPACE,
}

Expand Down
2 changes: 1 addition & 1 deletion cypress/testcases/virtualmachines/network.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Add a network to an existing VM with only 1 network', () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
networks: [{
network: NETWORK_1,
}],
Expand Down
4 changes: 2 additions & 2 deletions cypress/testcases/virtualmachines/virtual-machine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Create a vm with all the default values', () => {
name: VM_NAME,
cpu: '2',
memory: '4',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
namespace,
}

Expand Down Expand Up @@ -62,7 +62,7 @@ describe('Create VM without memory provided', () => {
const value = {
name: VM_NAME,
cpu: '2',
image: imageEnv.name,
image: Cypress._.toLower(imageEnv.name),
namespace,
}

Expand Down

0 comments on commit 6a49cbc

Please sign in to comment.