-
-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests for public/private/csr generation * Add integration testing skeleton for mac and ubuntu * Merge integration within lib test to avoid too many workflows * Disable integration testing on windows for now * Use sudo to start integration test script as lsof fails on MacOS. lsof: WARNING: can't stat() vmhgfs file system * Add basic integration testing for now to assert proxy works as expected when started out of develop branch * Add a call to inbuilt http server to verify it works * wait for server to accept requests
- Loading branch information
1 parent
8babac3
commit e84c212
Showing
3 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
# TODO: Option to also shutdown proxy.py after | ||
# integration testing is done. Atleast on | ||
# macOS and ubuntu, pkill and kill commands | ||
# will do the job. | ||
# | ||
# For github action, we simply bank upon GitHub | ||
# to clean up any background process including | ||
# proxy.py | ||
|
||
# Wait for server to come up | ||
while true; do | ||
if [[ $(lsof -i TCP:8899 | wc -l | tr -d ' ') == 0 ]]; then | ||
echo "Waiting for proxy..." | ||
sleep 1 | ||
else | ||
break | ||
fi | ||
done | ||
|
||
# Wait for http proxy and web server to start | ||
while true; do | ||
curl -v \ | ||
--max-time 1 \ | ||
--connect-timeout 1 \ | ||
-x localhost:8899 \ | ||
http://localhost:8899/ 2>/dev/null | ||
if [[ $? == 0 ]]; then | ||
break | ||
fi | ||
echo "Waiting for web server to start accepting requests..." | ||
sleep 1 | ||
done | ||
|
||
# Check if proxy was started with integration | ||
# testing web server plugin. If detected, use | ||
# internal web server for integration testing. | ||
|
||
# If integration testing plugin is not found, | ||
# detect if we have internet access. If we do, | ||
# then use httpbin.org for integration testing. | ||
curl -v \ | ||
-x localhost:8899 \ | ||
http://httpbin.org/get | ||
if [[ $? != 0 ]]; then | ||
echo "http request failed" | ||
exit 1 | ||
fi | ||
|
||
curl -v \ | ||
-x localhost:8899 \ | ||
https://httpbin.org/get | ||
if [[ $? != 0 ]]; then | ||
echo "https request failed" | ||
exit 1 | ||
fi | ||
|
||
curl -v \ | ||
-x localhost:8899 \ | ||
http://localhost:8899/ | ||
if [[ $? != 0 ]]; then | ||
echo "http request to built in webserver failed" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |