Add functional job with redis enabled

Some of the "unit" test cases required actual redis running. This
introduces a separate job with actual redis service enabled so that
we run these tests in CI.

Change-Id: I1ddb580e9e8eb34937acba934520a998d249da3c
This commit is contained in:
Takashi Kajinami 2024-04-15 16:39:47 +09:00
parent 6dba127ad0
commit f46a54aa95
7 changed files with 60 additions and 0 deletions

View File

@ -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

View File

@ -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]

View File

@ -0,0 +1,5 @@
---
backend_services_map:
redis:
- redis-server
- redis-sentinel

View File

@ -0,0 +1,5 @@
---
backend_services_map:
redis:
- redis
- redis-sentinel

View File

@ -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] }}"

View File

@ -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

View File

@ -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}