diff options
author | Samuli Silvius <s.silvius@partner.samsung.com> | 2019-05-23 12:50:57 +0300 |
---|---|---|
committer | Samuli Silvius <s.silvius@partner.samsung.com> | 2019-05-23 12:50:57 +0300 |
commit | bc83f936c1b369fc6291898ec88b6c6c17b2aa5d (patch) | |
tree | 595919d2d8cf5acca507d6f7b8135da1ac23c979 /kud/tests/_common_test.sh | |
parent | 3eeb40cfe56366ca72e811bdfb6f2faf127f8a2f (diff) |
Install jq as an dependency for yq
Before using yq binary we need to install also its
dependency jq.
This commit is fixing jq installation in case it was
required as dependency for yq.
Also refactored a bit dependency installations of tests.
Issue-ID: MULTICLOUD-617
Change-Id: I0ea1143befa1cff809c231422b5cfb14fba1de4e
Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com>
Diffstat (limited to 'kud/tests/_common_test.sh')
-rwxr-xr-x | kud/tests/_common_test.sh | 50 |
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 +} |