-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathintegration_test.sh
executable file
·38 lines (32 loc) · 1.2 KB
/
integration_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
# shellcheck disable=SC2155
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
TEST_CASE="${TEST_CASE:-SCRIPT_DIR}"
source "${SCRIPT_DIR}/../helm-deploy.sh"
source "${SCRIPT_DIR}/../logging.sh"
printMessage "Start: \"${SCRIPT_DIR/\//}\""
function integration_test() {
start-up "--set image.repositoryNameAndTag=mockserver/mockserver:integration_testing"
TEST_EXIT_CODE=0
sleep 3
runCommand "curl -v -s -X PUT 'http://${MOCKSERVER_HOST}/mockserver/expectation' -d \"{
'httpRequest' : {
'path' : '/some/path'
},
'httpResponse' : {
'body' : 'some_response_body'
}
}\"" || TEST_EXIT_CODE=1
if [[ "${TEST_EXIT_CODE}" == "0" ]]; then
RESPONSE_BODY=$(runCommand "curl -v -s -X PUT 'http://${MOCKSERVER_HOST}/some/path'")
if [[ "${RESPONSE_BODY}" != "some_response_body" ]]; then
printFailureMessage "Failed to retrieve response body for expectation matched by path, found: \"${RESPONSE_BODY}\""
TEST_EXIT_CODE=1
fi
fi
logTestResult "${TEST_EXIT_CODE}" "${TEST_CASE}"
tear-down
return ${TEST_EXIT_CODE}
}
integration_test