Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Mar 11, 2024
1 parent 3a51ed2 commit c93b9bb
Showing 1 changed file with 6 additions and 114 deletions.
120 changes: 6 additions & 114 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,125 +18,17 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: "1"
if: always()
run: |
# container_id=$(docker run -d -p 5901:5901 --security-opt seccomp=unconfined quay.io/consideratio/test:turbo vncserver -xstartup /opt/install/jupyter_remote_desktop_proxy/share/xstartup -verbose -fg -geometry 1680x1050 -SecurityTypes None -rfbport 5901)
container_id=$(docker run -d -p 5901:5901 -v $(pwd):/mnt/test --security-opt seccomp=unconfined quay.io/consideratio/test:turbo python /mnt/test/dummy-tcp-server.py)
sleep 3
# echo "::group::Installing netcat (inside container)"
# docker exec --user root $container_id bash -c '
# apt update
# apt install -y netcat
# '
# echo "::endgroup::"
echo "::group::Testing vncserver with netcat (inside container)"
docker exec $container_id bash -c 'timeout --preserve-status 1 nc -v localhost 5901' 2>&1 | tee output-inside.txt
cat output-inside.txt | grep --quiet RFB && echo "Passed inside test" || { echo "Failed inside test" && TEST_OK=false; }
echo "::endgroup::"
echo "::group::Testing vncserver with netcat (outside container)"
timeout --preserve-status 1 nc -v localhost 5901 2>&1 | tee output-outside.txt
cat output-outside.txt | grep --quiet RFB && echo "Passed outside test" || { echo "Failed outside test" && TEST_OK=false; }
echo "::endgroup::"
# echo "::group::vncserver logs"
# docker exec $container_id bash -c "cat ~/.vnc/*.log"
# echo "::endgroup::"
docker logs $container_id
docker stop $container_id > /dev/null
if [ "$TEST_OK" == "false" ]; then
echo "One or more tests failed!"
exit 1
fi
bash 1.sh
- name: "2"
if: always()
run: |
# container_id=$(docker run -d -p 5901:5901 --security-opt seccomp=unconfined quay.io/consideratio/test:turbo websockify --verbose --log-file=/tmp/websockify.log --heartbeat=30 5901 -- vncserver -xstartup /opt/install/jupyter_remote_desktop_proxy/share/xstartup -verbose -fg -geometry 1680x1050 -SecurityTypes None -rfbport 5901)
container_id=$(docker run -d -p 5901:5901 -v $(pwd):/mnt/test quay.io/consideratio/test:turbo websockify --verbose --log-file=/tmp/websockify.log --heartbeat=30 5901 -- python /mnt/test/dummy-tcp-server.py)
sleep 3
# echo "::group::Installing websocat (inside container)"
# docker exec --user root $container_id bash -c '
# wget -q https://github.com/vi/websocat/releases/download/v1.12.0/websocat.x86_64-unknown-linux-musl \
# -O /usr/local/bin/websocat
# chmod +x /usr/local/bin/websocat
# '
# echo "::endgroup::"
# echo "::group::Testing websockify'ed vncserver with websocat (inside container)"
docker exec $container_id bash -c 'websocat --binary --one-message --exit-on-eof "ws://localhost:5901/"' 2>&1 | \
grep --quiet RFB && echo "Passed inside test" || { echo "Failed inside test" && TEST_OK=false; }
# echo "::endgroup::"
# echo "::group::Testing websockify'ed vncserver with websocat (outside container)"
websocat --binary --one-message --exit-on-eof "ws://localhost:5901/" 2>&1 | \
grep --quiet RFB && echo "Passed outside test" || { echo "Failed outside test" && TEST_OK=false; }
# echo "::endgroup::"
# echo "::group::websockify logs"
# docker exec $container_id bash -c "cat /tmp/websockify.log"
# echo "::endgroup::"
echo "netstat inside container"
docker exec $container_id netstat -na --tcp | grep -E "(:5901|:5902)"
echo "netstat outside container"
netstat -na --tcp | grep -E "(:5901|:5902)"
# echo "::group::vncserver logs"
# docker exec $container_id bash -c "cat ~/.vnc/*.log"
# echo "::endgroup::"
docker stop $container_id > /dev/null
if [ "$TEST_OK" == "false" ]; then
echo "One or more tests failed!"
exit 1
fi
bash 2.sh
- name: "3"
if: always()
run: |
container_id=$(docker run -d -p 8888:8888 --security-opt seccomp=unconfined -e JUPYTER_TOKEN=secret quay.io/consideratio/test:tiger)
sleep 5
# echo "::group::Testing /desktop/ to return rendered index.html template"
curl --silent --fail 'http://localhost:8888/desktop/?token=secret' | grep --quiet 'Jupyter Remote Desktop Proxy' && echo "Passed get index.html test" || { echo "Failed" && TEST_OK=false; }
# echo "::endgroup::"
# echo "::group::Testing /desktop/ to provide pre-built viewer.js"
curl --silent --fail 'http://localhost:8888/desktop/static/dist/viewer.js?token=secret' > /dev/null && echo "Passed get viewer.js test" || { echo "Failed" && TEST_OK=false; }
# echo "::endgroup::"
# echo "::group::Testing /desktop-websockify/ to return a vncserver typical response, accepting one initial test failure"
websocat --binary --one-message --exit-on-eof 'ws://localhost:8888/desktop-websockify/?token=secret' | grep --quiet RFB && echo "Passed initial websocket test" || { \
echo "Failed initial websocket test" && sleep 3 && websocat --binary --one-message --exit-on-eof 'ws://localhost:8888/desktop-websockify/?token=secret' | grep --quiet RFB && echo "Passed second websocket test" || { echo "Failed second websocket test" && TEST_OK=false; } \
}
# echo "::endgroup::"
# echo "::group::jupyter_server logs"
# docker logs $container_id
# echo "::endgroup::"
# echo "::group::websockify logs"
# docker exec $container_id bash -c "cat /tmp/websockify.log"
# echo "::endgroup::"
# echo "::group::vncserver logs"
# docker exec $container_id bash -c "cat ~/.vnc/*.log"
# echo "::endgroup::"
echo "netstat inside container"
docker exec $container_id netstat -na --tcp | grep -E "(:5901|:5902)"
echo "netstat outside container"
netstat -na --tcp | grep -E "(:5901|:5902)"
# echo "::group::Testing container's ability to terminate via SIGTERM"
timeout 5 docker stop $container_id > /dev/null && echo "Passed SIGTERM test" || { echo "Failed" && TEST_OK=false; }
# echo "::endgroup::"
if [ "$TEST_OK" == "false" ]; then
echo "One or more tests failed!"
exit 1
fi
bash 3.sh
Expand Down

0 comments on commit c93b9bb

Please sign in to comment.