debian-forge-composer/test/cases/api/common/vsphere.sh
Tomáš Hozza 7e2d112783 test/api: add checkEnvVSphere() to common/vsphere.sh
Add a common function to check for all environment variables needed to
test VSphere image. Call the function from all S3 implementations of
`checkEnv()` if testing the VSphere image type.
2022-09-19 10:37:32 +02:00

30 lines
887 B
Bash

#!/usr/bin/bash
source /usr/libexec/tests/osbuild-composer/shared_lib.sh
function installClientVSphere() {
if ! hash govc; then
ARCH="$(uname -m)"
if [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
fi
greenprint "Installing govc"
pushd "${WORKDIR}" || exit 1
curl -Ls --retry 5 --output govc.tar.gz \
"https://github.com/vmware/govmomi/releases/download/v0.29.0/govc_Linux_$ARCH.tar.gz"
tar -xvf govc.tar.gz
GOVC_CMD="${WORKDIR}/govc"
chmod +x "${GOVC_CMD}"
popd || exit 1
else
echo "Using pre-installed 'govc' from the system"
GOVC_CMD="govc"
fi
$GOVC_CMD version
}
function checkEnvVSphere() {
printenv GOVMOMI_USERNAME GOVMOMI_PASSWORD GOVMOMI_URL GOVMOMI_CLUSTER GOVC_DATACENTER GOVMOMI_DATASTORE GOVMOMI_FOLDER GOVMOMI_NETWORK > /dev/null
}