CI: New jobs

This follows removal of jobs from project-config. [1]

New jobs use newer node versions and new Zuul v3 format,
reusing devstack for deployment of OpenStack for functional
testing of jslib.

Version tests have been adapted to follow support logic
already in place instead of hardcoded supported versions.

Includes workaround (fixup) of devstack's bug. [2]

Move the functional test to experimental for now, because version
discovery doesn't work right and Firefox is generally grumpy.
We want to get the structural stuff in first.

[1] https://review.opendev.org/702030
[2] https://bugs.launchpad.net/devstack/+bug/1860287

Depends-on: https://review.opendev.org/704882
Depends-on: https://review.opendev.org/726547
Co-authored-by: Monty Taylor <mordred@inaugust.com>
Change-Id: I197eb2b59be7a49d168edf09d554b444bbcc29b2
changes/32/702132/31
Radosław Piliszek 3 years ago
parent a88f833861
commit 8354146c11

@ -0,0 +1,4 @@
---
- hosts: all
roles:
- fetch-javascript-output

@ -0,0 +1,14 @@
---
- hosts: all
tasks:
# NOTE(yoctozepto): devstack starts WSGI-based, API services too early
# to make post-config apply to them
# see: https://bugs.launchpad.net/devstack/+bug/1860287
- name: "Restart devstack API services"
command: "systemctl restart devstack@{{ item }}"
become: True
loop:
- keystone
- g-api
- q-svc
- n-api

@ -0,0 +1,12 @@
---
- hosts: all
roles:
- ensure-javascript-build-tool
- nodejs-test-dependencies
tasks:
# NOTE(yoctozepto): nodejs-test-dependencies role installs only
# chromium-browser but we need firefox too
- name: Install firefox
apt:
name: firefox
become: true

@ -0,0 +1,5 @@
---
- hosts: all
roles:
- revoke-sudo
- js-package-manager

@ -85,7 +85,7 @@ export default class AbstractService {
*/
_rawVersions() {
return new Promise((resolve, reject) => {
let promise = this.http
this.http
.httpGet(this._endpointUrl)
.catch((response) => {
if (response.status === 401) {
@ -96,13 +96,12 @@ export default class AbstractService {
return this.http.httpGet(rootUrl.href);
} else {
return reject(response);
throw response;
}
});
promise
})
.then((response) => response.json())
.then((body) => resolve(body.versions));
.then((body) => resolve(body.versions))
.catch(reject);
});
}

@ -48,11 +48,6 @@ describe("Glance", () => {
});
describe("version()", () => {
const supportedApiVersions = [
new Version('2.5')
];
/**
* This test acts as a canary, to inform the SDK developers that the Glance API
* has changed in a significant way.
@ -62,14 +57,7 @@ describe("Glance", () => {
.then((config) => new Glance(config))
.then((glance) => glance.version())
.then((apiVersion) => {
for (let i = 0; i < supportedApiVersions.length; i++) {
let supportedVersion = supportedApiVersions[i];
if (apiVersion.equals(supportedVersion)) {
done();
return;
}
}
fail(`Current devstack glance version (${apiVersion}) is not supported.`);
expect(apiVersion instanceof Version).not.toBeFalsy();
done();
})
.catch((error) => done.fail(error));

@ -41,11 +41,6 @@ describe("Keystone", () => {
});
describe("version()", () => {
const supportedApiVersions = [
new Version('3.8')
];
/**
* This test acts as a canary, to inform the SDK developers that the Keystone API
* has changed in a significant way.
@ -53,14 +48,7 @@ describe("Keystone", () => {
it("should return a supported version.", (done) => {
keystone.version()
.then((apiVersion) => {
for (let i = 0; i < supportedApiVersions.length; i++) {
let supportedVersion = supportedApiVersions[i];
if (apiVersion.equals(supportedVersion)) {
done();
return;
}
}
fail(`Current devstack keystone version (${apiVersion}) is not supported.`);
expect(apiVersion instanceof Version).not.toBeFalsy();
done();
})
.catch((response) => response.json()

@ -48,11 +48,6 @@ describe("neutron", () => {
});
describe("version()", () => {
const supportedApiVersions = [
new Version('2.0')
];
/**
* This test acts as a canary, to inform the SDK developers that the Neutron API
* has changed in a significant way.
@ -62,14 +57,7 @@ describe("neutron", () => {
.then((config) => new Neutron(config))
.then((neutron) => neutron.version())
.then((apiVersion) => {
for (let i = 0; i < supportedApiVersions.length; i++) {
let supportedVersion = supportedApiVersions[i];
if (apiVersion.equals(supportedVersion)) {
done();
return;
}
}
fail(`Current devstack neutron version (${apiVersion}) is not supported.`);
expect(apiVersion instanceof Version).not.toBeFalsy();
done();
})
.catch((error) => done.fail(error));

@ -34,10 +34,6 @@ describe("Nova", () => {
.then((entry) => entry.endpoints.find((endpoint) => endpoint.interface === 'public'));
describe("version()", () => {
const supportedApiVersions = [
new Version('2.1')
];
/**
* This test acts as a canary, to inform the SDK developers that the Nova API
* has changed in a significant way.
@ -47,8 +43,7 @@ describe("Nova", () => {
.then((config) => new Nova(config))
.then((nova) => nova.version())
.then((apiVersion) => {
let found = supportedApiVersions.find((item) => item.equals(apiVersion));
expect(found).not.toBeFalsy();
expect(apiVersion instanceof Version).not.toBeFalsy();
done();
})
.catch((error) => done.fail(error));

@ -0,0 +1,65 @@
- job:
name: js-openstack-lib-functional-tests-base
# We use tox-functional-consumer as a base job because it's
# the closest we've got. It'll cause tox to get installed, but
# we override the run so it shouldn't matter.
parent: devstack-tox-functional-consumer
pre-run:
- playbooks/prepare-env-for-tests.yml
# NOTE(yoctozepto): devstack starts WSGI-based, API services too early
# to make post-config apply to them
# see: https://bugs.launchpad.net/devstack/+bug/1860287
- playbooks/fixup-devstack.yml
run: playbooks/run-npm.yml
post-run:
- playbooks/fetch-javascript-output.yml
vars:
npm_command: functional-test
# NOTE(yoctozepto): we need relaxed CORS allowed_origin to be able to
# test browsers without hacking them to ignore CORS
devstack_local_conf:
post-config:
$KEYSTONE_CONF:
cors:
allowed_origin: '*'
$GLANCE_API_CONF:
cors:
allowed_origin: '*'
$NEUTRON_CONF:
cors:
allowed_origin: '*'
$NOVA_CONF:
cors:
allowed_origin: '*'
devstack_services:
tls-proxy: false # FIXME(yoctozepto): we can't have tls atm
# NOTE(yoctozepto): disable Swift & Cinder - not tested atm
# but enabled by parent (let's conserve resources)
# Swift services
s-account: false
s-container: false
s-object: false
s-proxy: false
# Cinder services
c-api: false
c-bak: false
c-sch: false
c-vol: false
cinder: false
- job:
name: js-openstack-lib-unit-tests-nodejs12
parent: nodejs-run-test-browser
vars:
node_version: 12
- job:
name: js-openstack-lib-functional-tests-nodejs12
parent: js-openstack-lib-functional-tests-base
vars:
node_version: 12

@ -0,0 +1,15 @@
---
- project:
templates:
- nodejs8-docs
- nodejs8-jobs
- nodejs8-publish-to-npm
check:
jobs:
- js-openstack-lib-unit-tests-nodejs12
gate:
jobs:
- js-openstack-lib-unit-tests-nodejs12
experimental:
jobs:
- js-openstack-lib-functional-tests-nodejs12
Loading…
Cancel
Save