Skip to content

Commit

Permalink
debug test
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Jan 24, 2024
1 parent 58654f1 commit 34ebeb6
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 94 deletions.
178 changes: 90 additions & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
set -eux
yarn install
yarn run lint:check
- name: Package the application
shell: bash -l {0}
run: |
Expand All @@ -71,83 +71,83 @@ jobs:
dist/tljh_repo2docker*.whl
if-no-files-found: error

isolated-tests:
name: Isolated tests
needs: build
runs-on: ubuntu-latest

steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: "x64"

- uses: actions/download-artifact@v3
with:
name: tljh_repo2docker-artifacts

- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
python -m pip install git+https://github.com/jupyterhub/the-littlest-jupyterhub tljh_repo2docker*.whl
- name: Test import
shell: bash -l {0}
run: python -c "import tljh_repo2docker"

unit-tests:
name: Unit tests
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
jupyterhub-version: [latest, 1.2.2]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: "1.5.5-0"
environment-name: tljh
init-shell: bash
create-args: >-
python=${{ matrix.python-version }}
nodejs=18
yarn=3
- name: Download app package
uses: actions/download-artifact@v3
with:
name: tljh_repo2docker-artifacts

- name: Install package
shell: bash -l {0}
run: |
set -eux
python -m pip install -r dev-requirements.txt
python -m pip install tljh_repo2docker*.whl
npm -g install configurable-http-proxy
- name: Downgrade jupyterhub
if: ${{ matrix.jupyterhub-version != 'latest' }}
shell: bash -l {0}
run: |
python -m pip install -U 'jupyterhub==${{ matrix.jupyterhub-version }}'
- name: Run Tests
shell: bash -l {0}
run: |
python -m pytest --cov
# isolated-tests:
# name: Isolated tests
# needs: build
# runs-on: ubuntu-latest

# steps:
# - name: Install Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# architecture: "x64"

# - uses: actions/download-artifact@v3
# with:
# name: tljh_repo2docker-artifacts

# - name: Install and Test
# run: |
# set -eux
# # Remove NodeJS, twice to take care of system and locally installed node versions.
# sudo rm -rf $(which node)
# sudo rm -rf $(which node)

# python -m pip install git+https://github.com/jupyterhub/the-littlest-jupyterhub tljh_repo2docker*.whl

# - name: Test import
# shell: bash -l {0}
# run: python -c "import tljh_repo2docker"

# unit-tests:
# name: Unit tests
# needs: build
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# python-version: ["3.8", "3.9", "3.10"]
# jupyterhub-version: [latest, 1.2.2]

# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Set up Python ${{ matrix.python-version }}
# uses: mamba-org/setup-micromamba@v1
# with:
# micromamba-version: "1.5.5-0"
# environment-name: tljh
# init-shell: bash
# create-args: >-
# python=${{ matrix.python-version }}
# nodejs=18
# yarn=3

# - name: Download app package
# uses: actions/download-artifact@v3
# with:
# name: tljh_repo2docker-artifacts

# - name: Install package
# shell: bash -l {0}
# run: |
# set -eux
# python -m pip install -r dev-requirements.txt
# python -m pip install tljh_repo2docker*.whl
# npm -g install configurable-http-proxy

# - name: Downgrade jupyterhub
# if: ${{ matrix.jupyterhub-version != 'latest' }}
# shell: bash -l {0}
# run: |
# python -m pip install -U 'jupyterhub==${{ matrix.jupyterhub-version }}'

# - name: Run Tests
# shell: bash -l {0}
# run: |
# python -m pytest --cov

integration-tests:
name: Integration tests
Expand All @@ -171,6 +171,7 @@ jobs:
python=3.10
nodejs=18
yarn=3
wget
- name: Download app package
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -204,16 +205,17 @@ jobs:
run: npx playwright install chromium
working-directory: frontend/ui-tests

- name: Start JupyterHub
shell: bash -l {0}
run: |
python -m jupyterhub -f ./jupyterhub_config.py &
- name: Wait for JupyterHub
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://localhost:8000
timeout: 360000
# - name: Start JupyterHub
# shell: bash -l {0}
# working-directory: frontend/ui-tests
# run: |
# python -m jupyterhub -f ../../jupyterhub_config.py &

# - name: Wait for JupyterHub
# uses: ifaxity/wait-on-action@v1
# with:
# resource: http-get://localhost:8000
# timeout: 360000

- name: Execute integration tests
shell: bash -l {0}
Expand Down
14 changes: 8 additions & 6 deletions frontend/ui-tests/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ module.exports = {
reporter: [[process.env.CI ? 'dot' : 'list'], ['html']],
use: {
baseURL: 'http://localhost:8000',
video: 'retain-on-failure'
video: 'retain-on-failure',
trace: 'on-first-retry'
},
retries: 0,
expect: {
toMatchSnapshot: {
maxDiffPixelRatio: 0.005
}
retries: 1,
webServer: {
command: 'python -m jupyterhub -f ../../jupyterhub_config.py',
url: 'http://localhost:8000',
timeout: 120 * 1000,
reuseExistingServer: true
}
};
4 changes: 4 additions & 0 deletions frontend/ui-tests/tests/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ test.describe('tljh_repo2docker UI Tests', () => {
await login(page, 'user');
expect(await page.screenshot()).toMatchSnapshot();
});

test('Render servers page', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Servers' }).click();
await page.waitForURL('**/servers');
await page.waitForTimeout(1000);
await page.getByText('No servers are running');
expect(await page.screenshot()).toMatchSnapshot();
});

test('Render environments page', async ({ page }) => {
await login(page, 'alice');
await page.getByRole('link', { name: 'Environments' }).click();
await page.waitForURL('**/environments');
await page.waitForTimeout(1000);
await page.getByText('No environment available');
expect(await page.screenshot()).toMatchSnapshot();
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tljh_repo2docker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from typing import Any, Coroutine, Optional

from aiodocker import Docker
from dockerspawner import DockerSpawner
Expand Down

0 comments on commit 34ebeb6

Please sign in to comment.