blob: d02cb5da8e155214fcc6b841af574e6ce9a7cbe6 [file] [log] [blame]
#!/bin/bash
set -o xtrace
source /var/onap/commons
# asserts_image() - Function that verifies if a specific image was created
function asserts_image {
local image=$1
local error_msg=${2:-"There is no $image image"}
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
raise_error $error_msg
fi
}
# asserts_installed_package() - Function that verifies if a specific package was installed.
function asserts_installed_package {
local package=$1
local error_msg=${2:-"$package wasn't installed"}
if ! is_package_installed $package; then
raise_error $error_msg
fi
}
# asserts_file_exist() - Function that verifies if a specific file exists
function asserts_file_exist {
local file=$1
local error_msg=${2:-"$file doesn't exist"}
if [ ! -f $file ]; then
raise_error $error_msg
fi
}
# raise_error() - Function that prints and exits the execution
function raise_error {
echo $@
exit 1
}