aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/lib/asserts
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2017-08-06 11:23:15 -0500
committerVictor Morales <victor.morales@intel.com>2017-08-06 11:26:02 -0500
commit158c18c732e97119880e6a8bddf85ed0ea5d41af (patch)
tree2ec5fc28dcf6932a3d50ddb038c8916572ac466c /bootstrap/vagrant-onap/lib/asserts
parent3529c70a5bff5139f6d483a86ddfca407374022f (diff)
Add AAI Unit Tests
This change includes the addition of Unit Tests for A&AI component and the required refactor process in their functions Change-Id: Ib3b1109e7e80d5ef51e682445b7ecbf600bf3e62 Signed-off-by: Victor Morales <victor.morales@intel.com>
Diffstat (limited to 'bootstrap/vagrant-onap/lib/asserts')
-rwxr-xr-xbootstrap/vagrant-onap/lib/asserts33
1 files changed, 33 insertions, 0 deletions
diff --git a/bootstrap/vagrant-onap/lib/asserts b/bootstrap/vagrant-onap/lib/asserts
index d02cb5da8..02c269b4c 100755
--- a/bootstrap/vagrant-onap/lib/asserts
+++ b/bootstrap/vagrant-onap/lib/asserts
@@ -4,11 +4,44 @@ set -o xtrace
source /var/onap/commons
+# asserts_process() - Function that verifies if a specific process is running
+function asserts_process {
+ local process=$1
+ local error_msg=${2:-"There is no $process running process"}
+
+ if [[ "ps -ef | grep $process" == "" ]]; then
+ raise_error $error_msg
+ fi
+}
+
+# asserts_java_process() - Function that verifies if a specific java process is running
+function asserts_java_process {
+ local process=$1
+ local error_msg=${2:-"There is no $process java running process"}
+
+ install_java
+ if [[ "jps | grep $process" == "" ]]; then
+ raise_error $error_msg
+ fi
+}
+
+# asserts_image_running() - Function that verifies if a specific image is running
+function asserts_image_running {
+ local image=$1
+ local error_msg=${2:-"There is no process with $image image running"}
+
+ asserts_image $image
+ if [[ "$(docker ps -q --filter=ancestor=$image 2> /dev/null)" == "" ]]; then
+ raise_error $error_msg
+ fi
+}
+
# 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"}
+ install_docker
if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
raise_error $error_msg
fi