summaryrefslogtreecommitdiffstats
path: root/kud/tests/_common_test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'kud/tests/_common_test.sh')
-rwxr-xr-xkud/tests/_common_test.sh50
1 files changed, 40 insertions, 10 deletions
diff --git a/kud/tests/_common_test.sh b/kud/tests/_common_test.sh
index be22db9a..1c6af678 100755
--- a/kud/tests/_common_test.sh
+++ b/kud/tests/_common_test.sh
@@ -15,15 +15,45 @@ set -o pipefail
# install_deps() - Install dependencies required for functional tests
function install_deps {
if ! $(jq --version &>/dev/null); then
- source /etc/os-release || source /usr/lib/os-release
- case ${ID,,} in
- *suse)
- ;;
- ubuntu|debian)
- sudo apt-get install -y jq
- ;;
- rhel|centos|fedora)
- ;;
- esac
+ function ubuntu_deps {
+ sudo apt-get install -y jq
+ }
+ install_packages "" ubuntu_deps ""
fi
}
+
+# install_ovn_deps() - Install dependencies required for tests that require OVN
+function install_ovn_deps {
+ if ! $(yq --version &>/dev/null); then
+ install_deps # jq needed as it's dependency of yq
+ sudo -E pip install yq
+ fi
+ if ! $(ovn-nbctl --version &>/dev/null); then
+ function ovn_ubuntu_deps {
+ sudo apt-get install -y apt-transport-https
+ echo "deb https://packages.wand.net.nz $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/wand.list
+ sudo curl https://packages.wand.net.nz/keyring.gpg -o /etc/apt/trusted.gpg.d/wand.gpg
+ sudo apt-get update
+ sudo apt install -y ovn-common
+ }
+ install_packages "" ovn_ubuntu_deps ""
+ fi
+}
+
+function install_packages {
+ local suse_packages=$1
+ local ubuntu_debian_packages=$2
+ local rhel_centos_packages=$3
+ source /etc/os-release || source /usr/lib/os-release
+ case ${ID,,} in
+ *suse)
+ ($suse_packages)
+ ;;
+ ubuntu|debian)
+ ($ubuntu_debian_packages)
+ ;;
+ rhel|centos|fedora)
+ ($rhel_centos_packages)
+ ;;
+ esac
+}