Skip to content

Commit

Permalink
[CONSUL-212] Create/update dummy test case using jq or curl as test o…
Browse files Browse the repository at this point in the history
…utput
  • Loading branch information
cocoseries committed Jul 14, 2022
1 parent f9b5691 commit 248b11d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/integration/connect/envoy/Dockerfile-bats-windows
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ RUN choco install openssl -yf
RUN choco install jq -yf

COPY --from=fortio C:\\fortio C:\\fortio
ENV PATH C:\\fortio;%PATH%

ENV PATH C:\\fortio;%PATH%
ENV PATH C:\\Windows\\System32;%PATH%
ENV PATH C:\\ProgramData\\chocolatey\\lib\\jq\\tools;%PATH%
16 changes: 16 additions & 0 deletions test/integration/connect/envoy/case-dummy-bats/dummy-function.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,19 @@ function dummyFunction {
local LOCAL_VAR=$1
echo $LOCAL_VAR $COMMON_VAR
}

function curlFunction {
/c/fortio/fortio.exe server -quiet > server.txt 2>&1 &
# curl -s -f localhost:8080/fortio/rest/run --data-raw "{\"url\" :\"localhost:8080\"}" | jq ".URL"
# sleep 5
# echo $URL
$(/c/Windows/System32/taskkill.exe /f /t /im fortio.exe)
}

function testFunction {
if (echo $1 | grep '^envoy') ; then
echo OK
else
echo NOOK
fi
}
10 changes: 10 additions & 0 deletions test/integration/connect/envoy/case-dummy-bats/verify_2.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@ teardown() {

[ "$status" -eq 100000 ]
}

@test "Test Function with Curl" {
run curlFunction

[ $status -eq 0 ]
[ -n "$output" ]
echo $output > output.txt
# [ "$output" = "\"http://localhost:8080\"" ]
# echo "$output" | grep "^\"http://localhost:8080"
}

0 comments on commit 248b11d

Please sign in to comment.