From de4adde69e5dc7dddc305bf888429d10ea348e6e Mon Sep 17 00:00:00 2001 From: "zhu.boxiang" Date: Tue, 14 Sep 2021 14:21:42 +0800 Subject: [PATCH] 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 --- .zuul.yaml | 42 +++++++++++++++---- README-zh_CN.md | 2 +- README.md | 2 +- devstack/README.rst | 8 ++-- devstack/plugin.sh | 16 ++++--- devstack/settings | 2 +- .../skyline_nginx/templates/nginx.conf.j2 | 2 +- playbooks/devstack/post.yaml | 4 ++ playbooks/devstack/pre.yaml | 21 ++++++++++ playbooks/devstack/run-devstack.yaml | 4 ++ playbooks/devstack/run-tox.yaml | 6 +++ tox.ini | 10 ++++- 12 files changed, 98 insertions(+), 21 deletions(-) create mode 100644 playbooks/devstack/post.yaml create mode 100644 playbooks/devstack/pre.yaml create mode 100644 playbooks/devstack/run-devstack.yaml create mode 100644 playbooks/devstack/run-tox.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 89264aa..ea77e6c 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -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 diff --git a/README-zh_CN.md b/README-zh_CN.md index 51100a3..cf77748 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -138,7 +138,7 @@ Skyline 的吉祥物是九色鹿。九色鹿源自于敦煌壁画《九色鹿本 ### 访问测试 -现在你可以访问仪表盘: `https://:8080` +现在你可以访问仪表盘: `https://:9999` ## 开发 Skyline-apiserver diff --git a/README.md b/README.md index 94d27b2..c1d848c 100644 --- a/README.md +++ b/README.md @@ -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://:8080` +You can now access the dashboard: `https://:9999` ## Develop Skyline-apiserver diff --git a/devstack/README.rst b/devstack/README.rst index e86e26b..42105ab 100644 --- a/devstack/README.rst +++ b/devstack/README.rst @@ -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 diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 5bd5ecd..343f3dd 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -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 # --------- diff --git a/devstack/settings b/devstack/settings index 8c99375..fed41b0 100644 --- a/devstack/settings +++ b/devstack/settings @@ -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 diff --git a/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 b/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 index 8156a96..709d33d 100644 --- a/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 +++ b/libs/skyline-nginx/skyline_nginx/templates/nginx.conf.j2 @@ -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 }}; diff --git a/playbooks/devstack/post.yaml b/playbooks/devstack/post.yaml new file mode 100644 index 0000000..c335a53 --- /dev/null +++ b/playbooks/devstack/post.yaml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - fetch-subunit-output diff --git a/playbooks/devstack/pre.yaml b/playbooks/devstack/pre.yaml new file mode 100644 index 0000000..8cfce16 --- /dev/null +++ b/playbooks/devstack/pre.yaml @@ -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 diff --git a/playbooks/devstack/run-devstack.yaml b/playbooks/devstack/run-devstack.yaml new file mode 100644 index 0000000..95c40e0 --- /dev/null +++ b/playbooks/devstack/run-devstack.yaml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - orchestrate-devstack diff --git a/playbooks/devstack/run-tox.yaml b/playbooks/devstack/run-tox.yaml new file mode 100644 index 0000000..2a47fbf --- /dev/null +++ b/playbooks/devstack/run-tox.yaml @@ -0,0 +1,6 @@ +--- +- hosts: controller + roles: + - role: tox + vars: + zuul_work_dir: "{{ zuul.projects['opendev.org/skyline/skyline-apiserver'].src_dir }}" diff --git a/tox.ini b/tox.ini index 28d42ca..94f231d 100644 --- a/tox.ini +++ b/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"