Browse Source

Import OVN LB functional tests

This patch imports OVN LB functional tests.

Unfortunately neutron hasn't been released yet
so for test requirements we need to install it
from git, from commit that imports functional
base class to neutron [1].

[1] https://review.opendev.org/#/c/701733/


Change-Id: Ia65492db1688f3a3fce22a4432ae8445f67c37b3
changes/86/708386/13
Maciej Józefczyk 1 year ago
parent
commit
ec629c2e0c
17 changed files with 1333 additions and 5 deletions
  1. +1170
    -0
      ovn_octavia_provider/tests/functional/test_driver.py
  2. +4
    -0
      playbooks/configure_functional_job.yaml
  3. +5
    -0
      playbooks/post_functional_job.yaml
  4. +10
    -0
      playbooks/run_functional_job.yaml
  5. +21
    -0
      roles/configure_functional_tests/README.rst
  6. +7
    -0
      roles/configure_functional_tests/defaults/main.yaml
  7. +20
    -0
      roles/configure_functional_tests/tasks/main.yaml
  8. +16
    -0
      roles/fetch_journal_log/README.rst
  9. +2
    -0
      roles/fetch_journal_log/defaults/main.yaml
  10. +22
    -0
      roles/fetch_journal_log/tasks/main.yaml
  11. +8
    -0
      roles/setup_logdir/README.rst
  12. +1
    -0
      roles/setup_logdir/defaults/main.yaml
  13. +8
    -0
      roles/setup_logdir/tasks/main.yaml
  14. +4
    -0
      test-requirements.txt
  15. +1
    -1
      tox.ini
  16. +32
    -0
      zuul.d/base.yaml
  17. +2
    -4
      zuul.d/project.yaml

+ 1170
- 0
ovn_octavia_provider/tests/functional/test_driver.py
File diff suppressed because it is too large
View File


+ 4
- 0
playbooks/configure_functional_job.yaml View File

@ -0,0 +1,4 @@
- hosts: all
roles:
- setup_logdir
- configure_functional_tests

+ 5
- 0
playbooks/post_functional_job.yaml View File

@ -0,0 +1,5 @@
- hosts: all
roles:
- fetch_journal_log
- fetch-tox-output
- fetch-subunit-output

+ 10
- 0
playbooks/run_functional_job.yaml View File

@ -0,0 +1,10 @@
- hosts: all
roles:
- run-devstack
# Run bindep and test-setup after devstack so that they won't interfere
- role: bindep
bindep_profile: test
bindep_dir: "{{ zuul_work_dir }}"
- test-setup
- ensure-tox
- tox

+ 21
- 0
roles/configure_functional_tests/README.rst View File

@ -0,0 +1,21 @@
Configure host to run on it Neutron functional/fullstack tests
**Role Variables**
.. zuul:rolevar:: tests_venv
:default: {{ tox_envlist }}
.. zuul:rolevar:: project_name
:default: neutron
.. zuul:rolevar:: base_dir
:default: {{ ansible_user_dir }}/src/opendev.org
.. zuul:rolevar:: gate_dest_dir
:default: {{ base_dir }}/openstack
.. zuul:rolevar:: devstack_dir
:default: {{ base_dir }}/openstack/devstack
.. zuul:rolevar:: neutron_dir
:default: {{ gate_dest_dir }}/neutron

+ 7
- 0
roles/configure_functional_tests/defaults/main.yaml View File

@ -0,0 +1,7 @@
tests_venv: "{{ tox_envlist }}"
project_name: "ovn-octavia-provider"
base_dir: "{{ ansible_user_dir }}/src/opendev.org"
gate_dest_dir: "{{ base_dir }}/openstack"
devstack_dir: "{{ base_dir }}/openstack/devstack"
neutron_dir: "{{ gate_dest_dir }}/neutron"
ovn_octavia_provider_dir: "{{ gate_dest_dir }}/ovn-octavia-provider"

+ 20
- 0
roles/configure_functional_tests/tasks/main.yaml View File

@ -0,0 +1,20 @@
- shell:
cmd: |
set -e
set -x
GATE_STACK_USER={{ ansible_user }}
IS_GATE=True
BASE_DIR={{ base_dir }}
GATE_DEST={{ gate_dest_dir }}
PROJECT_NAME={{ project_name }}
NEUTRON_PATH={{ neutron_dir }}
DEVSTACK_PATH={{ devstack_dir }}
VENV={{ tests_venv }}
source $DEVSTACK_PATH/functions
source $NEUTRON_PATH/devstack/lib/ovs
source $NEUTRON_PATH/tools/configure_for_func_testing.sh
configure_host_for_func_testing
executable: /bin/bash

+ 16
- 0
roles/fetch_journal_log/README.rst View File

@ -0,0 +1,16 @@
Collect journal log from test run
By default, this stores journal log into log file and store it in
"journal_log_file_path"
**Role Variables**
.. zuul:rolevar:: journal_log_path
:default: {{ ansible_user_dir }}/workspace/logs
Path where journal log file will be stored on job's node.
.. zuul:rolevar:: journal_log_file_name
:default: {{ journal_log_path }}/journal.log
Name of journal log file.

+ 2
- 0
roles/fetch_journal_log/defaults/main.yaml View File

@ -0,0 +1,2 @@
journal_log_path: "{{ ansible_user_dir }}/logs"
journal_log_file_name: "{{ journal_log_path }}/journal.log"

+ 22
- 0
roles/fetch_journal_log/tasks/main.yaml View File

@ -0,0 +1,22 @@
- name: Ensure {{ journal_log_path }} exists
become: yes
file:
path: "{{ journal_log_path }}"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: 0775
- name: Store journal logs in {{ journal_log_file_name }}
become: yes
shell:
cmd: |
/bin/journalctl -a > {{ journal_log_file_name }}
- name: Set journal.log file permissions
become: yes
file:
path: '{{ journal_log_file_name }}'
owner: '{{ ansible_user }}'
group: '{{ ansible_user }}'
mode: 0644

+ 8
- 0
roles/setup_logdir/README.rst View File

@ -0,0 +1,8 @@
Configure logs dir to be accessible for ``stack`` user.
**Role Variables**
.. zuul:rolevar:: logdir
:default: /opt/stack/logs
Name of the directory where logs will be stored.

+ 1
- 0
roles/setup_logdir/defaults/main.yaml View File

@ -0,0 +1 @@
logdir: /opt/stack/logs

+ 8
- 0
roles/setup_logdir/tasks/main.yaml View File

@ -0,0 +1,8 @@
- name: Ensure logdir exists
become: yes
file:
path: "{{ logdir }}"
state: directory
owner: stack
group: "{{ ansible_user }}"
mode: 0775

+ 4
- 0
test-requirements.txt View File

@ -17,4 +17,8 @@ testresources>=2.0.0 # Apache-2.0/BSD
testscenarios>=0.4 # Apache-2.0/BSD
WebTest>=2.0.27 # MIT
testtools>=2.2.0 # MIT
# NOTE: Precisely we need ussuri neutron and neutron 15.y.z is train release
# but zuul installs neutron master as we specify it as required-projects.
# Let's update the lower bound once neutron ussuri is releaesd including beta.
neutron>=15.0.0 # Apache-2.0

+ 1
- 1
tox.ini View File

@ -52,7 +52,7 @@ setenv = {[testenv:functional]setenv}
{[testenv:dsvm]setenv}
deps = {[testenv:functional]deps}
commands =
{toxinidir}/tools/ostestr_compat_shim.sh {posargs}
stestr run {posargs}
[testenv:cover]
envdir = {toxworkdir}/shared


+ 32
- 0
zuul.d/base.yaml View File

@ -0,0 +1,32 @@
- job:
name: ovn-octavia-provider-functional
parent: devstack-minimal
description: Run OVN Octavia provider functional tests
timeout: 7800
required-projects:
- opendev.org/openstack/devstack
- openstack/neutron
- openstack/requirements
roles:
- zuul: openstack/devstack
pre-run: playbooks/configure_functional_job.yaml
run: playbooks/run_functional_job.yaml
post-run: playbooks/post_functional_job.yaml
irrelevant-files:
- ^.*\.rst$
- ^doc/.*$
- ^releasenotes/.*$
vars:
devstack_services:
# Ignore any default set by devstack. Emit a "disable_all_services".
base: false
devstack_localrc:
INSTALL_TESTONLY_PACKAGES: true
DATABASE_PASSWORD: stackdb
tox_envlist: dsvm-functional
tox_constraints_file: '{{ ansible_user_dir }}/src/opendev.org/openstack/requirements/upper-constraints.txt'
zuul_copy_output:
# We need to copy directory with logs to have it in job artifacts also,
# /opt/stack/logs is default logs directory defined in neutron's
# tox.ini file
'{{ devstack_base_dir }}/logs/dsvm-functional-logs': logs

+ 2
- 4
zuul.d/project.yaml View File

@ -11,9 +11,7 @@
required-projects:
- openstack/neutron
voting: false
- ovn-octavia-provider-functional
gate:
jobs:
- openstack-tox-cover:
required-projects:
- openstack/neutron
voting: false
- ovn-octavia-provider-functional

Loading…
Cancel
Save