diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d1b161d4..0a6ebd6e 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 /desktop-websockify/ to return vncserver response" + websocat --binary --one-message --exit-on-eof 'ws://127.0.0.1:8888/desktop-websockify/?token=secret' | grep RFB # TODO: Check VNC desktop works, e.g. by comparing Playwright screenshots # https://playwright.dev/docs/test-snapshots