From c62d95d42401bdef573172b141e26b1df223b6c7 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 5 Jul 2024 11:44:28 +0900 Subject: [PATCH] Add functional test with etcd Change-Id: I43606301c053c937333ab1454eca5f627682d085 --- .gitignore | 4 ++++ .zuul.yaml | 10 +++++++++ playbooks/tests/functional/Debian.yaml | 1 + playbooks/tests/functional/RedHat.yaml | 1 + setup-etcd-env.sh | 31 ++++++++++++++++++++++++++ tox.ini | 3 ++- 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 setup-etcd-env.sh diff --git a/.gitignore b/.gitignore index 1e59528e0..36b2c59c4 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,7 @@ env RELEASENOTES.rst releasenotes/notes/reno.cache releasenotes/build + +# Generated by etcd +etcd-v* +default.etcd diff --git a/.zuul.yaml b/.zuul.yaml index 781f28539..56f869991 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -31,6 +31,14 @@ tox_environment: PIFPAF_DAEMON: redis +- job: + name: taskflow-functional-etcd + parent: taskflow-functional + vars: + tox_environment: + PIFPAF_DAEMON: etcd + SETUP_ENV_SCRIPT: ./setup-etcd-env.sh + - project: templates: - check-requirements @@ -44,7 +52,9 @@ jobs: - taskflow-tox-py310-with-sqlalchemy-2x - taskflow-functional-redis + - taskflow-functional-etcd gate: jobs: - taskflow-tox-py310-with-sqlalchemy-2x - taskflow-functional-redis + - taskflow-functional-etcd diff --git a/playbooks/tests/functional/Debian.yaml b/playbooks/tests/functional/Debian.yaml index f70e27cf4..47e11046c 100644 --- a/playbooks/tests/functional/Debian.yaml +++ b/playbooks/tests/functional/Debian.yaml @@ -3,3 +3,4 @@ backend_services_map: redis: - redis-server - redis-sentinel + etcd: [] diff --git a/playbooks/tests/functional/RedHat.yaml b/playbooks/tests/functional/RedHat.yaml index cbb108bfe..37fe5a668 100644 --- a/playbooks/tests/functional/RedHat.yaml +++ b/playbooks/tests/functional/RedHat.yaml @@ -3,3 +3,4 @@ backend_services_map: redis: - redis - redis-sentinel + etcd: [] diff --git a/setup-etcd-env.sh b/setup-etcd-env.sh new file mode 100755 index 000000000..919aee124 --- /dev/null +++ b/setup-etcd-env.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -eux +if [ -z "$(which etcd)" ]; then + ETCD_VERSION=3.3.27 + case `uname -s` in + Darwin) + OS=darwin + SUFFIX=zip + ;; + Linux) + OS=linux + SUFFIX=tar.gz + ;; + *) + echo "Unsupported OS" + exit 1 + esac + case `uname -m` in + x86_64) + MACHINE=amd64 + ;; + *) + echo "Unsupported machine" + exit 1 + esac + TARBALL_NAME=etcd-v${ETCD_VERSION}-$OS-$MACHINE + test ! -d "$TARBALL_NAME" && curl -L https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${TARBALL_NAME}.${SUFFIX} | tar xz + export PATH=$PATH:$TARBALL_NAME +fi + +$* diff --git a/tox.ini b/tox.ini index 0f4b3c140..f71fb6d0c 100644 --- a/tox.ini +++ b/tox.ini @@ -26,9 +26,10 @@ commands = [testenv:functional] commands = find . -type f -name "*.pyc" -delete - pifpaf -e TAKSFLOW_TEST run {env:PIFPAF_DAEMON} {env:PIFPAF_OPTS} -- stestr run + {env:SETUP_ENV_SCRIPT} pifpaf -e TAKSFLOW_TEST run {env:PIFPAF_DAEMON} {env:PIFPAF_OPTS} -- stestr run allowlist_externals = find + ./setup-etcd-env.sh [testenv:update-states] deps =