diff --git a/.zuul.yaml b/.zuul.yaml index 5aac7839e..781f28539 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -16,6 +16,21 @@ override-checkout: main - name: openstack/oslo.db +- job: + name: taskflow-functional + parent: openstack-tox + abstract: true + pre-run: playbooks/tests/functional/pre.yml + vars: + tox_envlist: functional + +- job: + name: taskflow-functional-redis + parent: taskflow-functional + vars: + tox_environment: + PIFPAF_DAEMON: redis + - project: templates: - check-requirements @@ -28,6 +43,8 @@ check: jobs: - taskflow-tox-py310-with-sqlalchemy-2x + - taskflow-functional-redis gate: jobs: - taskflow-tox-py310-with-sqlalchemy-2x + - taskflow-functional-redis diff --git a/bindep.txt b/bindep.txt index f8da4bd32..e2d278974 100644 --- a/bindep.txt +++ b/bindep.txt @@ -15,3 +15,7 @@ mysql-server [platform:dpkg !platform:debian] postgresql postgresql-client [platform:dpkg] libpq-dev [platform:dpkg] + +redis [platform:rpm tests-functional-redis] +redis-server [platform:dpkg tests-functional-redis] +redis-sentinel [platform:dpkg tests-functional-redis] diff --git a/playbooks/tests/functional/Debian.yaml b/playbooks/tests/functional/Debian.yaml new file mode 100644 index 000000000..f70e27cf4 --- /dev/null +++ b/playbooks/tests/functional/Debian.yaml @@ -0,0 +1,5 @@ +--- +backend_services_map: + redis: + - redis-server + - redis-sentinel diff --git a/playbooks/tests/functional/RedHat.yaml b/playbooks/tests/functional/RedHat.yaml new file mode 100644 index 000000000..cbb108bfe --- /dev/null +++ b/playbooks/tests/functional/RedHat.yaml @@ -0,0 +1,5 @@ +--- +backend_services_map: + redis: + - redis + - redis-sentinel diff --git a/playbooks/tests/functional/pre.yml b/playbooks/tests/functional/pre.yml new file mode 100644 index 000000000..5e4e02afb --- /dev/null +++ b/playbooks/tests/functional/pre.yml @@ -0,0 +1,21 @@ +- hosts: all + vars: + taskflow_backend_daemon: "{{ tox_environment.PIFPAF_DAEMON }}" + roles: + - role: bindep + bindep_profile: "tests-functional-{{ taskflow_backend_daemon }}" + tasks: + - name: Include OS-specific variables + include_vars: "{{ ansible_os_family }}.yaml" + # NOTE(yoctozepto): Debian and Ubuntu have this nasty policy of starting + # installed services for us. We don't rely on system-wide service and use + # pifpaf. Unfortunately, default port may conflict with system-wide service. + # So, for sanity and resource conservation, let's stop it before tests run. + - name: "Stop backend services" + service: + name: "{{ item }}" + state: stopped + enabled: no + become: yes + loop: "{{ backend_services_map[taskflow_backend_daemon] }}" + diff --git a/test-requirements.txt b/test-requirements.txt index c9c3dd0f5..5a80cac49 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -29,5 +29,6 @@ oslotest>=3.2.0 # Apache-2.0 testtools>=2.2.0 # MIT testscenarios>=0.4 # Apache-2.0/BSD stestr>=2.0.0 # Apache-2.0 +pifpaf>=0.10.0 # Apache-2.0 pre-commit>=2.6.0 # MIT diff --git a/tox.ini b/tox.ini index 1e59d92a6..ef07fa0c1 100644 --- a/tox.ini +++ b/tox.ini @@ -23,6 +23,13 @@ commands = sphinx-build -E -W -b html doc/source doc/build/html doc8 doc/source +[testenv:functional] +commands = + find . -type f -name "*.pyc" -delete + pifpaf -e TAKSFLOW_TEST run {env:PIFPAF_DAEMON} {env:PIFPAF_OPTS} -- stestr run +allowlist_externals = + find + [testenv:update-states] deps = {[testenv]deps}