From 3c0e06ea0cdf3098497274dd8ff5a63b117d20c5 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 16 Feb 2024 22:59:09 +0100 Subject: [PATCH] tests: run vagrant_up.sh from dirname Signed-off-by: Guillaume Abrioux --- tests/scripts/vagrant_up.sh | 11 ++++++++++- tox-cephadm.ini | 2 +- tox-docker2podman.ini | 2 +- tox-external_clients.ini | 2 +- tox-podman.ini | 2 +- tox-rbdmirror.ini | 4 ++-- tox-shrink_osd.ini | 2 +- tox-subset_update.ini | 2 +- tox-update.ini | 2 +- tox.ini | 4 ++-- 10 files changed, 21 insertions(+), 12 deletions(-) diff --git a/tests/scripts/vagrant_up.sh b/tests/scripts/vagrant_up.sh index 6a87f408a2..05b17582f4 100644 --- a/tests/scripts/vagrant_up.sh +++ b/tests/scripts/vagrant_up.sh @@ -1,4 +1,12 @@ #!/bin/bash +set -x +if [[ -n $1 ]]; then + DIRECTORY=$1 + shift +else + DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +fi +pushd "${DIRECTORY}" if [[ "${CEPH_ANSIBLE_VAGRANT_BOX}" =~ "centos/stream" ]]; then EL_VERSION="${CEPH_ANSIBLE_VAGRANT_BOX: -1}" @@ -16,4 +24,5 @@ do sleep 5 done -sleep 10 \ No newline at end of file +sleep 10 +popd diff --git a/tox-cephadm.ini b/tox-cephadm.ini index 582d035f11..f84357d1dc 100644 --- a/tox-cephadm.ini +++ b/tox-cephadm.ini @@ -29,7 +29,7 @@ changedir= {toxinidir}/tests/functional/cephadm commands= ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} ansible-playbook -vv --diff -i {changedir}/hosts {toxinidir}/infrastructure-playbooks/cephadm.yml --extra-vars "\ diff --git a/tox-docker2podman.ini b/tox-docker2podman.ini index 7774b13249..33eb779f64 100644 --- a/tox-docker2podman.ini +++ b/tox-docker2podman.ini @@ -29,7 +29,7 @@ changedir= {toxinidir}/tests/functional/docker2podman commands= ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} # configure lvm diff --git a/tox-external_clients.ini b/tox-external_clients.ini index bf33c3edb3..b03f30211c 100644 --- a/tox-external_clients.ini +++ b/tox-external_clients.ini @@ -32,7 +32,7 @@ deps= -r{toxinidir}/tests/requirements.txt changedir={toxinidir}/tests/functional/external_clients{env:CONTAINER_DIR:} commands= ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} ansible-playbook -vv --diff -i {changedir}/inventory {toxinidir}/tests/functional/setup.yml diff --git a/tox-podman.ini b/tox-podman.ini index c458cf6d4e..6dfd6f9209 100644 --- a/tox-podman.ini +++ b/tox-podman.ini @@ -33,7 +33,7 @@ changedir= {toxinidir}/tests/functional/podman commands= ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} # configure lvm diff --git a/tox-rbdmirror.ini b/tox-rbdmirror.ini index 38bc4dffee..bba6460d07 100644 --- a/tox-rbdmirror.ini +++ b/tox-rbdmirror.ini @@ -40,7 +40,7 @@ deps= -r{toxinidir}/tests/requirements.txt changedir={toxinidir}/tests/functional/rbdmirror{env:CONTAINER_DIR:} commands= ansible-galaxy install -r {toxinidir}/requirements.yml -v - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} non_container: ansible-playbook -vv --diff -i "localhost," -c local {toxinidir}/tests/functional/dev_setup.yml --extra-vars "dev_setup={env:DEV_SETUP:False} change_dir={changedir} ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest}" --tags "vagrant_setup" @@ -63,7 +63,7 @@ commands= ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \ " - bash -c "cd {changedir}/secondary && bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}" + bash -c "cd {changedir}/secondary && bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir}/secondary --no-provision {posargs:--provider=virtualbox}" bash -c "cd {changedir}/secondary && bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}/secondary" ansible-playbook --ssh-common-args='-F {changedir}/secondary/vagrant_ssh_config -o ControlMaster=auto -o ControlPersist=600s -o PreferredAuthentications=publickey' -vv -i {changedir}/secondary/hosts {toxinidir}/tests/functional/setup.yml ansible-playbook -vv --diff -i "localhost," -c local {toxinidir}/tests/functional/dev_setup.yml --extra-vars "dev_setup={env:DEV_SETUP:False} change_dir={changedir}/secondary ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest}" --tags "vagrant_setup" diff --git a/tox-shrink_osd.ini b/tox-shrink_osd.ini index 077eb3e53c..fc6bb6328b 100644 --- a/tox-shrink_osd.ini +++ b/tox-shrink_osd.ini @@ -84,7 +84,7 @@ commands= ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections ansible-playbook -vv --diff -i "localhost," -c local {toxinidir}/tests/functional/dev_setup.yml --extra-vars "dev_setup={env:DEV_SETUP:False} change_dir={changedir} ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest}" --tags "vagrant_setup" - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} # configure lvm diff --git a/tox-subset_update.ini b/tox-subset_update.ini index 17d6fad203..f4b6e0f213 100644 --- a/tox-subset_update.ini +++ b/tox-subset_update.ini @@ -37,7 +37,7 @@ deps= -r{toxinidir}/tests/requirements.txt changedir={toxinidir}/tests/functional/subset_update{env:CONTAINER_DIR:} commands= ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} ansible-playbook -vv --diff -i {changedir}/{env:INVENTORY} {toxinidir}/tests/functional/setup.yml diff --git a/tox-update.ini b/tox-update.ini index 81a2119080..7ced3a4f23 100644 --- a/tox-update.ini +++ b/tox-update.ini @@ -36,7 +36,7 @@ setenv= deps= -r{toxinidir}/tests/requirements.txt changedir={toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:} commands= - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections diff --git a/tox.ini b/tox.ini index 08bfeb18b7..0870c66580 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,7 @@ setenv= deps= -r{toxinidir}/tests/requirements.txt changedir={toxinidir}/tests/functional/infra_lv_create commands= - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} ansible-playbook -vv --diff -i {changedir}/hosts {toxinidir}/infrastructure-playbooks/lv-create.yml @@ -330,7 +330,7 @@ commands= ansible-galaxy collection install -r {toxinidir}/requirements.yml -v -p {envdir}/ansible_collections non_container: ansible-playbook -vv --diff -i "localhost," -c local {toxinidir}/tests/functional/dev_setup.yml --extra-vars "dev_setup={env:DEV_SETUP:False} change_dir={changedir} ceph_dev_branch={env:CEPH_DEV_BRANCH:main} ceph_dev_sha1={env:CEPH_DEV_SHA1:latest}" --tags "vagrant_setup" - bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox} + bash {toxinidir}/tests/scripts/vagrant_up.sh {changedir} --no-provision {posargs:--provider=virtualbox} bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir} # configure lvm, we exclude osd2 given this node uses lvm batch scenario (see corresponding inventory host file)