aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap/tests/asserts
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-11-16 20:34:41 +0000
committerGerrit Code Review <gerrit@onap.org>2017-11-16 20:34:41 +0000
commiteb3849ef8a5377e09aba704baee738222bb649bb (patch)
tree3770b1504f801254c033185ba3fcf66858230195 /bootstrap/vagrant-onap/tests/asserts
parent218d6a41c1c3a2e24f6c3ae73ccc6497f35c1437 (diff)
parent88d193e157c75cc544b92401aaac5ce6caaa3d8a (diff)
Merge "Implement steps for Multicloud Images"
Diffstat (limited to 'bootstrap/vagrant-onap/tests/asserts')
-rwxr-xr-xbootstrap/vagrant-onap/tests/asserts12
1 files changed, 12 insertions, 0 deletions
diff --git a/bootstrap/vagrant-onap/tests/asserts b/bootstrap/vagrant-onap/tests/asserts
index 52f0bce92..0fc8d38a1 100755
--- a/bootstrap/vagrant-onap/tests/asserts
+++ b/bootstrap/vagrant-onap/tests/asserts
@@ -2,6 +2,18 @@
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