3 source /var/onap/commons
5 # asserts_process() - Function that verifies if a specific process is running
6 function asserts_process {
8 local error_msg=${2:-"There is no $process running process"}
10 if [[ "ps -ef | grep $process" == "" ]]; then
11 raise_error $error_msg
15 # asserts_java_process() - Function that verifies if a specific java process is running
16 function asserts_java_process {
18 local error_msg=${2:-"There is no $process java running process"}
21 if [[ "jps | grep $process" == "" ]]; then
22 raise_error $error_msg
26 # asserts_image_running() - Function that verifies if a specific image is running
27 function asserts_image_running {
29 local error_msg=${2:-"There is no process with $image image running"}
32 if [[ "$(docker ps -q --filter=ancestor=$image 2> /dev/null)" == "" ]]; then
33 raise_error $error_msg
37 # asserts_image() - Function that verifies if a specific image was created
38 function asserts_image {
40 local error_msg=${2:-"There is no $image image"}
43 if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
44 raise_error $error_msg
48 # asserts_installed_package() - Function that verifies if a specific package was installed.
49 function asserts_installed_package {
51 local error_msg=${2:-"$package wasn't installed"}
53 if ! is_package_installed $package; then
54 raise_error $error_msg
58 # asserts_file_exist() - Function that verifies if a specific file exists
59 function asserts_file_exist {
61 local error_msg=${2:-"$file doesn't exist"}
63 if [ ! -f $file ]; then
64 raise_error $error_msg
68 # raise_error() - Function that prints and exits the execution
69 function raise_error {