From 467d02459c1396c79a8b2630040629727851b0a1 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sun, 10 Mar 2024 09:14:15 +0100 Subject: [PATCH] Fix not fully functional basic tests --- .github/workflows/test.yaml | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d1b161d4..e42ae6ca 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,23 +26,42 @@ jobs: 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 + - name: Build image run: | docker build --build-arg vncserver=${{ matrix.vncserver }} -t jupyter-remote-desktop-proxy . + - name: websockify --help + run: | + docker run jupyter-remote-desktop-proxy websockify --help + + - name: 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 jupyter-remote-desktop-proxy bash -c "vncserver -help || vncserver -list > /dev/null" + - name: Smoke test image run: | container_id=$(docker run -d -p 8888:8888 -e JUPYTER_TOKEN=secret jupyter-remote-desktop-proxy) - # -help flag is only available for TigerVNC, where TurboVNC can't - # print info without returning an error code. - docker exec $container_id vncserver -help || true - docker exec $container_id vncserver -list - + # wait for jupyter_server startup sleep 10 - curl 'http://localhost:8888/desktop/?token=secret' | grep 'Jupyter Remote Desktop Proxy' - # Test if the built JS file is present in the image - curl 'http://localhost:8888/desktop/dist/viewer.js?token=secret' > /dev/null + + echo "Testing /desktop/ to return rendered index.html template" + curl --silent --fail 'http://localhost:8888/desktop/?token=secret' | grep 'Jupyter Remote Desktop Proxy' + + echo "Testing /desktop/ to provide pre-built viewer.js" + curl --silent --fail 'http://localhost:8888/desktop/static/dist/viewer.js?token=secret' > /dev/null + + echo "Testing connectivity to /desktop-websockify/" + websocat --binary --one-message --exit-on-eof 'ws://127.0.0.1:8888/desktop-websockify/?token=secret' # TODO: Check VNC desktop works, e.g. by comparing Playwright screenshots # https://playwright.dev/docs/test-snapshots