test/api: move govc installation to common/vsphere.sh

Move the installation of the VSphere client out of the
`api/common/aws.sh` `installClient()` function into a dedicated
`installClientVSphere()` function in `api/common/vsphere.sh`.

Rename the `installClient()` in `api/common/aws.sh` to
`installAWSClient()`. Introduce `installClient()` in both,
`api/aws.sh` and `api/aws.s3.sh`, which calls `installAWSClient()`.

Call `installClientVSphere()` conditionally when testing VMDK image type
in `api/aws.s3.sh` and `api/generic.s3.sh`.
This commit is contained in:
Tomáš Hozza 2022-09-14 22:09:00 +02:00 committed by Tomáš Hozza
parent 2f6c238b7a
commit 9e9aec5b53
5 changed files with 44 additions and 20 deletions

View file

@ -2,6 +2,7 @@
source /usr/libexec/tests/osbuild-composer/api/common/aws.sh
source /usr/libexec/tests/osbuild-composer/api/common/common.sh
source /usr/libexec/tests/osbuild-composer/api/common/vsphere.sh
source /usr/libexec/tests/osbuild-composer/api/common/s3.sh
# Check that needed variables are set to access AWS.
@ -33,6 +34,14 @@ function cleanup() {
fi
}
function installClient() {
installAWSClient
if [ "${IMAGE_TYPE}" == "${IMAGE_TYPE_VSPHERE}" ]; then
installClientVSphere
fi
}
function createReqFile() {
case ${IMAGE_TYPE} in
"$IMAGE_TYPE_EDGE_COMMIT"|"$IMAGE_TYPE_EDGE_CONTAINER"|"$IMAGE_TYPE_EDGE_INSTALLER"|"$IMAGE_TYPE_IMAGE_INSTALLER")