5 source /var/onap/commons
7 # asserts_process() - Function that verifies if a specific process is running
8 function asserts_process {
10 local error_msg=${2:-"There is no $process running process"}
12 if [[ "ps -ef | grep $process" == "" ]]; then
13 raise_error $error_msg
17 # asserts_java_process() - Function that verifies if a specific java process is running
18 function asserts_java_process {
20 local error_msg=${2:-"There is no $process java running process"}
23 if [[ "jps | grep $process" == "" ]]; then
24 raise_error $error_msg
28 # asserts_image_running() - Function that verifies if a specific image is running
29 function asserts_image_running {
31 local error_msg=${2:-"There is no process with $image image running"}
34 if [[ "$(docker ps -q --filter=ancestor=$image 2> /dev/null)" == "" ]]; then
35 raise_error $error_msg
39 # asserts_image() - Function that verifies if a specific image was created
40 function asserts_image {
42 local error_msg=${2:-"There is no $image image"}
45 if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
46 raise_error $error_msg
50 # asserts_installed_package() - Function that verifies if a specific package was installed.
51 function asserts_installed_package {
53 local error_msg=${2:-"$package wasn't installed"}
55 if ! is_package_installed $package; then
56 raise_error $error_msg
60 # asserts_file_exist() - Function that verifies if a specific file exists
61 function asserts_file_exist {
63 local error_msg=${2:-"$file doesn't exist"}
65 if [ ! -f $file ]; then
66 raise_error $error_msg
70 # raise_error() - Function that prints and exits the execution
71 function raise_error {