diff --git a/.zuul.yaml b/.zuul.yaml index 4e9b330d..c81e66f1 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -314,6 +314,7 @@ - openstack/devstack - openstack/glance - openstack/heat + - openstack/zun - openstack/keystone - openstack/neutron - openstack/nova @@ -568,11 +569,14 @@ - ^src/pages/management/.*$ - ^src/pages/user-center/.*$ - ^src/stores/heat/.*$ + - ^src/stores/zun/.*$ - ^src/stores/keystone/.*$ - ^src/resources/heat/.*$ + - ^src/resources/zun/.*$ - ^src/resources/keystone/.*$ - ^test/e2e/integration/pages/configuration/.*$ - ^test/e2e/integration/pages/heat/.*$ + - ^test/e2e/integration/pages/zun/.*$ - ^test/e2e/integration/pages/identity/.*$ - ^test/e2e/integration/pages/error.spec.js - ^test/e2e/integration/pages/login.spec.js @@ -614,11 +618,14 @@ - ^src/pages/management/.*$ - ^src/pages/user-center/.*$ - ^src/stores/heat/.*$ + - ^src/stores/zun/.*$ - ^src/stores/keystone/.*$ - ^src/resources/heat/.*$ + - ^src/resources/zun/.*$ - ^src/resources/keystone/.*$ - ^test/e2e/integration/pages/configuration/.*$ - ^test/e2e/integration/pages/heat/.*$ + - ^test/e2e/integration/pages/zun/.*$ - ^test/e2e/integration/pages/identity/.*$ - ^test/e2e/integration/pages/error.spec.js - ^test/e2e/integration/pages/login.spec.js @@ -697,11 +704,14 @@ - ^src/pages/management/.*$ - ^src/pages/user-center/.*$ - ^src/stores/heat/.*$ + - ^src/stores/zun/.*$ - ^src/stores/keystone/.*$ - ^src/resources/heat/.*$ + - ^src/resources/zun/.*$ - ^src/resources/keystone/.*$ - ^test/e2e/integration/pages/configuration/.*$ - ^test/e2e/integration/pages/heat/.*$ + - ^test/e2e/integration/pages/zun/.*$ - ^test/e2e/integration/pages/identity/.*$ - ^test/e2e/integration/pages/error.spec.js - ^test/e2e/integration/pages/login.spec.js diff --git a/playbooks/devstack/other/run-e2etests.yaml b/playbooks/devstack/other/run-e2etests.yaml index 340ba7df..d8f29526 100644 --- a/playbooks/devstack/other/run-e2etests.yaml +++ b/playbooks/devstack/other/run-e2etests.yaml @@ -15,6 +15,7 @@ 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/- heat/# - heat/" $config_file + sed -i "s/- zun/# - zun/" $config_file sed -i "s#username:.*#username: admin#" $config_file sed -i "s#password:.*#password: secretadmin#" $config_file sed -i "s#usernameAdmin:.*#usernameAdmin: admin#" $config_file diff --git a/test/e2e/config/config-other.yaml b/test/e2e/config/config-other.yaml index 2d0c528a..4515e6bd 100644 --- a/test/e2e/config/config-other.yaml +++ b/test/e2e/config/config-other.yaml @@ -14,6 +14,7 @@ env: imageCanChangePassword: false extensions: - heat + - zun testFiles: - pages/login.spec.js - pages/error.spec.js @@ -29,3 +30,6 @@ testFiles: - pages/configuration/setting.spec.js # heat - pages/heat/stack.spec.js + # zun + - pages/zun/container.spec.js + - pages/zun/capsule.spec.js diff --git a/test/e2e/config/config.yaml b/test/e2e/config/config.yaml index 2bcab8f4..0d9f1586 100644 --- a/test/e2e/config/config.yaml +++ b/test/e2e/config/config.yaml @@ -21,6 +21,7 @@ env: - heat - ironic - swift + - zun testFiles: - pages/login.spec.js - pages/error.spec.js @@ -65,3 +66,6 @@ testFiles: - pages/configuration/setting.spec.js # heat - pages/heat/stack.spec.js + # zun + - pages/zun/container.spec.js + - pages/zun/capsule.spec.js diff --git a/test/e2e/fixtures/zunCapsuleTemplate.yaml b/test/e2e/fixtures/zunCapsuleTemplate.yaml new file mode 100644 index 00000000..d4741de3 --- /dev/null +++ b/test/e2e/fixtures/zunCapsuleTemplate.yaml @@ -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 diff --git a/test/e2e/integration/pages/zun/capsule.spec.js b/test/e2e/integration/pages/zun/capsule.spec.js new file mode 100644 index 00000000..ffb0d05a --- /dev/null +++ b/test/e2e/integration/pages/zun/capsule.spec.js @@ -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(); + }); + }); +}); diff --git a/test/e2e/integration/pages/zun/container.spec.js b/test/e2e/integration/pages/zun/container.spec.js new file mode 100644 index 00000000..6e578b50 --- /dev/null +++ b/test/e2e/integration/pages/zun/container.spec.js @@ -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(); + }); + }); +}); diff --git a/test/e2e/support/constants.js b/test/e2e/support/constants.js index 36fcd61b..ebbdb668 100644 --- a/test/e2e/support/constants.js +++ b/test/e2e/support/constants.js @@ -61,6 +61,10 @@ export const settingUrl = '/configuration-admin/setting'; // stack export const stackListUrl = '/heat/stack'; +// zun +export const zunContainerListUrl = '/container/containers'; +export const zunCapsuleListUrl = '/container/capsules'; + export default { // compute instance: instanceListUrl,