Skip to content

Commit

Permalink
../..
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Mar 29, 2024
1 parent d52e08e commit 431691f
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,44 +95,35 @@ jobs:
matrix:
include:
- vncserver: tigervnc
image: quay.io/consideratio/test:tiger
- vncserver: turbovnc
image: quay.io/consideratio/test:turbo

steps:
- uses: actions/checkout@v4

- name: Install test requirements (websocat)
run: |
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
websocat --help=long
- name: Build image
run: |
docker build --build-arg vncserver=${{ matrix.vncserver }} -t jupyter-remote-desktop-proxy .
- name: (inside container) websockify --help
run: |
docker run ${{ matrix.image }} websockify --help
docker run jupyter-remote-desktop-proxy websockify --help
- name: (inside container) vncserver -help
run: |
# -help flag is not available for TurboVNC, but it emits the -help
# equivalent information anyhow if passed -help, but also errors. Due
# to this, we fallback to use the errorcode of vncsrever -list.
docker run ${{ matrix.image }} bash -c "vncserver -help || vncserver -list > /dev/null"
docker run jupyter-remote-desktop-proxy bash -c "vncserver -help || vncserver -list > /dev/null"
- name: Test vncserver
if: always()
run: |
container_id=$(docker run -d -p 5901:5901 ${{ matrix.image }} 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 jupyter-remote-desktop-proxy vncserver -xstartup /opt/install/jupyter_remote_desktop_proxy/share/xstartup -verbose -fg -geometry 1680x1050 -SecurityTypes None -rfbport 5901)
sleep 1
echo "::group::Testing vncserver with netcat"
timeout --preserve-status 1 nc -v localhost 5901 2>&1 | tee output.txt
cat output.txt | grep --quiet RFB && echo "Passed test" || { echo "Failed test" && TEST_OK=false; }
timeout --preserve-status 1 nc -v localhost 5901 2>&1 | \
grep --quiet RFB && echo "Passed test" || { echo "Failed test" && TEST_OK=false; }
echo "::endgroup::"
echo "::group::vncserver logs"
Expand All @@ -145,15 +136,22 @@ jobs:
exit 1
fi
- name: Install test requirement (websocat)
run: |
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
websocat --help=long
- name: Test websockify'ed vncserver
if: always()
run: |
container_id=$(docker run -d -p 5901:5901 ${{ matrix.image }} 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)
sleep 3
container_id=$(docker run -d -p 5901:5901 upyter-remote-desktop-proxy 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)
sleep 1
echo "::group::Testing websockify'ed vncserver with websocat"
websocat --binary --one-message --exit-on-eof "ws://localhost:5901/" 2>&1 | tee output.txt
cat output.txt | grep --quiet RFB && echo "Passed test" || { echo "Failed test" && TEST_OK=false; }
websocat --binary --one-message --exit-on-eof "ws://localhost:5901/" 2>&1 | \
grep --quiet RFB && echo "Passed test" || { echo "Failed test" && TEST_OK=false; }
echo "::endgroup::"
echo "::group::websockify logs"
Expand All @@ -173,24 +171,28 @@ jobs:
- name: Test project's proxy to websockify'ed vncserver
if: always()
run: |
container_id=$(docker run -d -p 8888:8888 --security-opt seccomp=unconfined -e JUPYTER_TOKEN=secret ${{ matrix.image }})
sleep 5
container_id=$(docker run -d -p 8888:8888 -e JUPYTER_TOKEN=secret jupyter-remote-desktop-proxy)
sleep 3
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" || { echo "Failed" && TEST_OK=false; }
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" || { echo "Failed" && TEST_OK=false; }
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" | \
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 "Failed initial websocket test" && sleep 1 && 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::Testing container's ability to terminate on SIGTERM"
timeout 5 docker stop $container_id > /dev/null && echo "Passed SIGTERM test" || { echo "Failed" && TEST_OK=false; }
echo "::endgroup::"
echo "::group::jupyter_server logs"
docker logs $container_id
echo "::endgroup::"
Expand Down

0 comments on commit 431691f

Please sign in to comment.