feat: Support devstack integrated functional test

1. add skyline-functional-devstack which inherits from devstack
2. add skyline-functional-devstack into check and gate job
3. add playbook to integrate with devstack for zuul
4. change the port from 8080 to 9999 because the 8080 is used for s3api
5. rename functional-py38 as unittest-py38
6. add install extra tools ready for skyline-console's e2e test

Change-Id: I7f4b549bec6573661e62dd2bd9a3355253afd47d
This commit is contained in:
zhu.boxiang 2021-09-14 14:21:42 +08:00
parent 8fd70b6823
commit de4adde69e
12 changed files with 98 additions and 21 deletions

@ -1,15 +1,41 @@
---
- job:
name: skyline-tox-functional-py38
parent: openstack-tox-functional-py38
name: skyline-functional-devstack
parent: devstack
description: |
Skyline py38 functional tests
Skyline functional tests job based on devstack (single-node).
pre-run: playbooks/devstack/pre.yaml
run:
- playbooks/devstack/run-devstack.yaml
- playbooks/devstack/run-tox.yaml
post-run:
- playbooks/devstack/post.yaml
required-projects:
- skyline/skyline-apiserver
vars:
devstack_plugins:
skyline-apiserver: https://opendev.org/skyline/skyline-apiserver
zuul_copy_output:
/var/log/skyline: logs
/etc/skyline: logs
/etc/nginx: logs
host-vars:
controller:
tox_install_siblings: false
tox_envlist: functional
- job:
name: skyline-tox-unittest-py38
parent: openstack-tox-py38
description: |
Skyline py38 unittest tests
vars:
python_version: 3.8
tox_envlist: functional-py38
tox_envlist: unittest-py38
- job:
name: skyline-tox-lint-py38
parent: openstack-tox-functional-py38
parent: openstack-tox-py38
description: |
Skyline code static analysis
vars:
@ -19,9 +45,11 @@
- project:
check:
jobs:
- skyline-tox-functional-py38
- skyline-tox-unittest-py38
- skyline-tox-lint-py38
- skyline-functional-devstack
gate:
jobs:
- skyline-tox-functional-py38
- skyline-tox-unittest-py38
- skyline-tox-lint-py38
- skyline-functional-devstack

@ -138,7 +138,7 @@ Skyline 的吉祥物是九色鹿。九色鹿源自于敦煌壁画《九色鹿本
### 访问测试
现在你可以访问仪表盘: `https://<ip_address>:8080`
现在你可以访问仪表盘: `https://<ip_address>:9999`
## 开发 Skyline-apiserver

@ -138,7 +138,7 @@ Skyline's mascot is the nine-color deer. The nine-color deer comes from Dunhuang
### Test Access
You can now access the dashboard: `https://<ip_address>:8080`
You can now access the dashboard: `https://<ip_address>:9999`
## Develop Skyline-apiserver

@ -15,11 +15,13 @@ Enabling Skyline in Devstack
> cat local.conf
[[local|localrc]]
enable_plugin skyline https://opendev.org/skyline/skyline-apiserver
enable_plugin skyline-apiserver https://opendev.org/skyline/skyline-apiserver
To use stable branches, make sure devstack is on that branch, and specify
the branch name to enable_plugin, for example::
enable_plugin skyline https://opendev.org/skyline/skyline-apiserver master
enable_plugin skyline-apiserver https://opendev.org/skyline/skyline-apiserver master
3. run ``stack.sh``
3. Run ``stack.sh``
4. Visit the skyline UI with 9999 port

@ -22,7 +22,6 @@ function _mkdir_chown_stack {
sudo chown $STACK_USER "$1"
}
function _skyline_config_set {
local file=$1
local old=$2
@ -30,14 +29,12 @@ function _skyline_config_set {
sed -i -e "s#$old#$new#g" $file
}
function _install_skyline_apiserver {
pushd $SKYLINE_DIR
make install
popd
}
function _install_skyline_console {
# nginx
install_package nginx
@ -48,7 +45,15 @@ function _install_skyline_console {
popd
}
function _install_extra_tools {
# install xvfb for skyline-console e2e test
# https://docs.cypress.io/guides/continuous-integration/introduction#Dependencies
if is_fedora; then
install_package xorg-x11-server-Xvfb gtk2-devel gtk3-devel libnotify-devel GConf2 nss libXScrnSaver alsa-lib
else
install_package libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
fi
}
function _install_dependent_tools {
# make
@ -84,8 +89,9 @@ function _install_dependent_tools {
fi
RETRY_UPDATE=True update_package_repo
install_package yarn
}
_install_extra_tools
}
# Functions
# ---------

@ -11,7 +11,7 @@ SKYLINE_REPO=${MISTRAL_REPO:-https://opendev.org/skyline/skyline-apiserver.git}
SKYLINE_BRANCH=${MISTRAL_BRANCH:-master}
# Set up default directories
SKYLINE_DIR=${DEST}/skyline
SKYLINE_DIR=${DEST}/skyline-apiserver
SKYLINE_CONF_DIR=${SKYLINE_CONF_DIR:-/etc/skyline}
SKYLINE_CONF_FILE=${SKYLINE_CONF_DIR}/skyline.yaml
SKYLINE_LOG_DIR=/var/log/skyline

@ -69,7 +69,7 @@ http {
# Virtual Host Configs
##
server {
listen 8080 ssl http2 default_server;
listen 9999 ssl http2 default_server;
root {{ skyline_console_static_path }};

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

@ -0,0 +1,21 @@
---
- hosts: controller
roles:
- ensure-tox
- hosts: controller
vars:
- devstack_base_dir: /opt/stack
- skyline_source_dirs: src/opendev.org/skyline/skyline-apiserver
tasks:
- name: Copy skyline-apiserver repos into devstack working directory
command: rsync -a {{ skyline_source_dirs }} {{ devstack_base_dir }}
become: yes
- name: Set ownership of repos
file:
path: '{{ devstack_base_dir }}'
state: directory
recurse: true
owner: stack
group: stack
become: yes

@ -0,0 +1,4 @@
---
- hosts: all
roles:
- orchestrate-devstack

@ -0,0 +1,6 @@
---
- hosts: controller
roles:
- role: tox
vars:
zuul_work_dir: "{{ zuul.projects['opendev.org/skyline/skyline-apiserver'].src_dir }}"

10
tox.ini

@ -1,7 +1,7 @@
[tox]
minversion = 3.18.0
# python runtimes: https://governance.openstack.org/tc/reference/runtimes/ussuri.html
envlist = functional-py38,lint
envlist = unittest-py38,lint,functional
skipsdist=true
# this allows tox to infer the base python from the environment name
# and override any basepython configured in this file
@ -18,7 +18,7 @@ setenv =
passenv = IGNORE_JS
deps = poetry != 1.1.8
[testenv:functional-py38]
[testenv:unittest-py38]
commands =
make install
make test
@ -27,3 +27,9 @@ commands =
commands =
make install
make lint
[testenv:functional]
whitelist_externals =
echo
commands =
echo "TODO: Add functional test for skyline-apiserver"