aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/tests/asserts
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/vagrant-onap/tests/asserts')
-rwxr-xr-xbootstrap/vagrant-onap/tests/asserts14
1 files changed, 12 insertions, 2 deletions
diff --git a/bootstrap/vagrant-onap/tests/asserts b/bootstrap/vagrant-onap/tests/asserts
index 02c269b4c..8eda3ce25 100755
--- a/bootstrap/vagrant-onap/tests/asserts
+++ b/bootstrap/vagrant-onap/tests/asserts
@@ -1,9 +1,19 @@
#!/bin/bash
-set -o xtrace
-
source /var/onap/commons
+# asserts_http_status_code() - Function that determines if a HTTP status code is retrieved from URL
+function asserts_http_status_code {
+ local url=$1
+ local expected_code=${2:-"200"}
+
+ code=$(curl -I $url | head -n 1 | cut -d$' ' -f2)
+ local error_msg=${3:-"The URL $url responded with $code status code"}
+ if [[ "$code" != "$expected_code" ]]; then
+ raise_error $error_msg
+ fi
+}
+
# asserts_process() - Function that verifies if a specific process is running
function asserts_process {
local process=$1