test: Add zun e2e test

1. create zun container test
2. start zun container test
3. pause zun container test
4. unpause zun container test
5. reboot zun container test
6. stop zun container test
7. delete zun container test
8. create zun capsule test
9. delete zun capsule test

Change-Id: If291bbfd1dde4a73b5e14c171e3bb885d687f480
This commit is contained in:
xusongfu 2022-06-06 13:25:54 +08:00
parent 6f9bb5808e
commit 3b2144c39d
8 changed files with 199 additions and 0 deletions

View File

@ -314,6 +314,7 @@
- openstack/devstack - openstack/devstack
- openstack/glance - openstack/glance
- openstack/heat - openstack/heat
- openstack/zun
- openstack/keystone - openstack/keystone
- openstack/neutron - openstack/neutron
- openstack/nova - openstack/nova
@ -568,11 +569,14 @@
- ^src/pages/management/.*$ - ^src/pages/management/.*$
- ^src/pages/user-center/.*$ - ^src/pages/user-center/.*$
- ^src/stores/heat/.*$ - ^src/stores/heat/.*$
- ^src/stores/zun/.*$
- ^src/stores/keystone/.*$ - ^src/stores/keystone/.*$
- ^src/resources/heat/.*$ - ^src/resources/heat/.*$
- ^src/resources/zun/.*$
- ^src/resources/keystone/.*$ - ^src/resources/keystone/.*$
- ^test/e2e/integration/pages/configuration/.*$ - ^test/e2e/integration/pages/configuration/.*$
- ^test/e2e/integration/pages/heat/.*$ - ^test/e2e/integration/pages/heat/.*$
- ^test/e2e/integration/pages/zun/.*$
- ^test/e2e/integration/pages/identity/.*$ - ^test/e2e/integration/pages/identity/.*$
- ^test/e2e/integration/pages/error.spec.js - ^test/e2e/integration/pages/error.spec.js
- ^test/e2e/integration/pages/login.spec.js - ^test/e2e/integration/pages/login.spec.js
@ -614,11 +618,14 @@
- ^src/pages/management/.*$ - ^src/pages/management/.*$
- ^src/pages/user-center/.*$ - ^src/pages/user-center/.*$
- ^src/stores/heat/.*$ - ^src/stores/heat/.*$
- ^src/stores/zun/.*$
- ^src/stores/keystone/.*$ - ^src/stores/keystone/.*$
- ^src/resources/heat/.*$ - ^src/resources/heat/.*$
- ^src/resources/zun/.*$
- ^src/resources/keystone/.*$ - ^src/resources/keystone/.*$
- ^test/e2e/integration/pages/configuration/.*$ - ^test/e2e/integration/pages/configuration/.*$
- ^test/e2e/integration/pages/heat/.*$ - ^test/e2e/integration/pages/heat/.*$
- ^test/e2e/integration/pages/zun/.*$
- ^test/e2e/integration/pages/identity/.*$ - ^test/e2e/integration/pages/identity/.*$
- ^test/e2e/integration/pages/error.spec.js - ^test/e2e/integration/pages/error.spec.js
- ^test/e2e/integration/pages/login.spec.js - ^test/e2e/integration/pages/login.spec.js
@ -697,11 +704,14 @@
- ^src/pages/management/.*$ - ^src/pages/management/.*$
- ^src/pages/user-center/.*$ - ^src/pages/user-center/.*$
- ^src/stores/heat/.*$ - ^src/stores/heat/.*$
- ^src/stores/zun/.*$
- ^src/stores/keystone/.*$ - ^src/stores/keystone/.*$
- ^src/resources/heat/.*$ - ^src/resources/heat/.*$
- ^src/resources/zun/.*$
- ^src/resources/keystone/.*$ - ^src/resources/keystone/.*$
- ^test/e2e/integration/pages/configuration/.*$ - ^test/e2e/integration/pages/configuration/.*$
- ^test/e2e/integration/pages/heat/.*$ - ^test/e2e/integration/pages/heat/.*$
- ^test/e2e/integration/pages/zun/.*$
- ^test/e2e/integration/pages/identity/.*$ - ^test/e2e/integration/pages/identity/.*$
- ^test/e2e/integration/pages/error.spec.js - ^test/e2e/integration/pages/error.spec.js
- ^test/e2e/integration/pages/login.spec.js - ^test/e2e/integration/pages/login.spec.js

View File

@ -15,6 +15,7 @@
cp test/e2e/config/config-other.yaml $config_file cp test/e2e/config/config-other.yaml $config_file
sed -i "s#baseUrl.*#baseUrl: https://127.0.0.1:9999#" $config_file sed -i "s#baseUrl.*#baseUrl: https://127.0.0.1:9999#" $config_file
sed -i "s/- heat/# - heat/" $config_file sed -i "s/- heat/# - heat/" $config_file
sed -i "s/- zun/# - zun/" $config_file
sed -i "s#username:.*#username: admin#" $config_file sed -i "s#username:.*#username: admin#" $config_file
sed -i "s#password:.*#password: secretadmin#" $config_file sed -i "s#password:.*#password: secretadmin#" $config_file
sed -i "s#usernameAdmin:.*#usernameAdmin: admin#" $config_file sed -i "s#usernameAdmin:.*#usernameAdmin: admin#" $config_file

View File

@ -14,6 +14,7 @@ env:
imageCanChangePassword: false imageCanChangePassword: false
extensions: extensions:
- heat - heat
- zun
testFiles: testFiles:
- pages/login.spec.js - pages/login.spec.js
- pages/error.spec.js - pages/error.spec.js
@ -29,3 +30,6 @@ testFiles:
- pages/configuration/setting.spec.js - pages/configuration/setting.spec.js
# heat # heat
- pages/heat/stack.spec.js - pages/heat/stack.spec.js
# zun
- pages/zun/container.spec.js
- pages/zun/capsule.spec.js

View File

@ -21,6 +21,7 @@ env:
- heat - heat
- ironic - ironic
- swift - swift
- zun
testFiles: testFiles:
- pages/login.spec.js - pages/login.spec.js
- pages/error.spec.js - pages/error.spec.js
@ -65,3 +66,6 @@ testFiles:
- pages/configuration/setting.spec.js - pages/configuration/setting.spec.js
# heat # heat
- pages/heat/stack.spec.js - pages/heat/stack.spec.js
# zun
- pages/zun/container.spec.js
- pages/zun/capsule.spec.js

View File

@ -0,0 +1,45 @@
kind: capsule
spec:
restartPolicy: Always
initContainers:
- workDir: /
command:
- wget
- '-O'
- /work-dir/index.html
- 'https://www.openstack.org/'
env:
ENV1: env1-value1
image: busybox
volumeMounts:
- mountPath: /work-dir
name: workdir
resources:
requests:
cpu: 0.1
memory: 128
containers:
- workDir: /
env:
ENV2: env2-value
image: nginx
volumeMounts:
- mountPath: /usr/share/nginx/html
name: workdir
ports:
- protocol: TCP
containerPort: 80
resources:
requests:
cpu: 0.5
memory: 512
volumes:
- cinder:
size: 1
name: workdir
metadata:
labels:
app: web
name: e2e-zun-capsule
annotations:
key1: value1

View File

@ -0,0 +1,36 @@
import { onlyOn } from '@cypress/skip-test';
import { zunCapsuleListUrl } from '../../../support/constants';
const zunServiceEnabled = (Cypress.env('extensions') || []).includes('zun');
onlyOn(!zunServiceEnabled, () => {
describe('Skip The zunCapsule Page', () => {
it('successfully skip', () => {});
});
});
onlyOn(zunServiceEnabled, () => {
describe('The zunCpsule Page', () => {
const listUrl = zunCapsuleListUrl;
const filename = 'zunCapsuleTemplate.yaml';
const zunCapsuleName = 'e2e-zun-capsule';
beforeEach(() => {
cy.login(listUrl);
});
it('successfully create', () => {
cy.clickHeaderButton(1)
.formAttachFile('template_file', filename)
.clickModalActionSubmitButton();
});
it('successfully delete', () => {
cy.tableSimpleSearchText(zunCapsuleName)
.checkTableFirstRow(zunCapsuleName)
.clickFirstActionButton()
.clickConfirmActionSubmitButton()
.checkEmptyTable();
});
});
});

View File

@ -0,0 +1,95 @@
import { onlyOn } from '@cypress/skip-test';
import { zunContainerListUrl } from '../../../support/constants';
const zunServiceEnabled = (Cypress.env('extensions') || []).includes('zun');
onlyOn(!zunServiceEnabled, () => {
describe('Skip The zunContainer Page', () => {
it('successfully skip', () => {});
});
});
onlyOn(zunServiceEnabled, () => {
describe('The zunContainer Page', () => {
const listUrl = zunContainerListUrl;
const uuid = Cypress._.random(0, 1e6);
const zunContainerName = `e2e-zunContainer-${uuid}`;
beforeEach(() => {
cy.login(listUrl);
});
it('successfully create', () => {
cy.clickHeaderButton(1)
.url()
.should('include', `${listUrl}/create`)
.wait(5000)
.formInput('containerName', zunContainerName)
.formInput('image', 'cirros')
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.wait(2000)
.clickStepActionNextButton()
.waitFormLoading()
.url()
.should('include', listUrl)
.closeNotice()
.waitStatusTextByFresh('Created');
});
it('successfully start', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Start')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Running');
});
it('successfully pause', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Pause')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Paused');
});
it('successfully unpause', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionButtonByTitle('Unpause')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Running');
});
it('successfully reboot', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Reboot')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Restarting')
.wait(5000)
.waitStatusTextByFresh('Running');
});
it('successfully stop', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickActionInMore('Stop')
.clickConfirmActionSubmitButton()
.waitStatusTextByFresh('Stopped');
});
it('successfully delete', () => {
cy.tableSimpleSearchText(zunContainerName)
.checkTableFirstRow(zunContainerName)
.clickFirstActionButton()
.clickConfirmActionSubmitButton()
.checkEmptyTable();
});
});
});

View File

@ -61,6 +61,10 @@ export const settingUrl = '/configuration-admin/setting';
// stack // stack
export const stackListUrl = '/heat/stack'; export const stackListUrl = '/heat/stack';
// zun
export const zunContainerListUrl = '/container/containers';
export const zunCapsuleListUrl = '/container/capsules';
export default { export default {
// compute // compute
instance: instanceListUrl, instance: instanceListUrl,