Skip to content

Commit 0a2d42d

Browse files
committed
playbook openvscode: add test scenario for standalone and non-standalone modes
1 parent 610407a commit 0a2d42d

4 files changed

Lines changed: 64 additions & 13 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
platforms:
3+
- name: workspace-src-ubuntu_jammy-nginx
4+
image: ghcr.io/utrechtuniversity/src-test-workspace:ubuntu_jammy-nginx
5+
command: /sbin/init
6+
pre_build_image: true
7+
published_ports:
8+
- 8080:80
9+
registry:
10+
url: $DOCKER_REGISTRY
11+
credentials:
12+
username: $DOCKER_USER
13+
password: $DOCKER_PW
14+
provisioner:
15+
name: ansible
16+
env:
17+
components:
18+
- name: openvscodeserver
19+
path: openvscodeserver.yml
20+
parameters:
21+
openvscode_base_path: "/ide"
22+
openvscode_jupyter_force_install: 'true'
23+
jhsp_external_addr: localhost:8080
24+
jupyterhub_app_pip_executable: uv_pip
25+
jupyterhub_debug: true
26+
jupyterhub_auth: noauth
27+
jupyterhub_activate_remote_user_auth: true # mock SRAM auth by enabling remote user auth in JupyterHub config, despite setting auth to noauth.
28+
jupyterhub_proxy_config:
29+
proxy_set_header:
30+
REMOTE_USER: "$$http_user" # allows us to set the 'user' header in tests to mock login. We need double dollar signs because of the way ansible's `to_yaml` filters escapes!
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
- name: Verify
3+
hosts: all
4+
gather_facts: false
5+
tasks:
6+
- name: Test OpenVSCode Server
7+
ansible.builtin.uri:
8+
url: http://localhost/ide
9+
method: GET
10+
headers:
11+
user: testuser
12+
return_content: true
13+
follow_redirects: true
14+
register: openvscode_login
15+
failed_when: openvscode_login.failed or openvscode_login.url != 'http://localhost/ide/user/testuser/'
16+
retries: 5
17+
delay: 3
18+
19+
- name: Assert content correct
20+
ansible.builtin.assert:
21+
that:
22+
- '"vscode-workbench" in openvscode_login.content'

molecule/playbook-openvscodeserver/molecule.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ provisioner:
1515
name: ansible
1616
env:
1717
components:
18+
- name: jupyterhub
19+
path: jupyterhub.yml
20+
parameters:
21+
jupyterhub_debug: true
22+
jupyter_auth: noauth
23+
jupyter_activate_remote_user_auth: true # mock SRAM auth by enabling remote user auth in JupyterHub config, despite setting auth to noauth.
24+
jupyter_proxy_config: "{ proxy_set_header: { REMOTE_USER: '$$http_user'} }"
1825
- name: openvscodeserver
1926
path: openvscodeserver.yml
2027
parameters:
2128
openvscode_base_path: "/ide"
22-
openvscode_jupyter_force_install: 'true'
23-
jhsp_external_addr: localhost:8080
24-
jupyterhub_app_pip_executable: uv_pip
25-
jupyterhub_debug: true
26-
jupyterhub_auth: noauth
27-
jupyterhub_activate_remote_user_auth: true # mock SRAM auth by enabling remote user auth in JupyterHub config, despite setting auth to noauth.
28-
jupyterhub_proxy_config:
29-
proxy_set_header:
30-
REMOTE_USER: "$$http_user" # allows us to set the 'user' header in tests to mock login. We need double dollar signs because of the way ansible's `to_yaml` filters escapes!
29+
openvscode_jupyter_force_install: 'false'

molecule/playbook-openvscodeserver/verify.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
hosts: all
44
gather_facts: false
55
tasks:
6-
- name: Test OpenVSCode Server
6+
- name: Test Open VSCode
77
ansible.builtin.uri:
8-
url: http://localhost/ide
8+
url: http://localhost/hub/spawn/testuser?next=%2Fhub%2Fuser%2Ftestuser%2Fide%2F
99
method: GET
1010
headers:
11-
user: testuser
11+
user: testuser # mock SRAM login
1212
return_content: true
1313
follow_redirects: true
1414
register: openvscode_login
15-
failed_when: openvscode_login.failed or openvscode_login.url != 'http://localhost/ide/user/testuser/'
15+
failed_when: openvscode_login.failed or not openvscode_login.url is match('http://localhost/user/testuser/ide')
1616
retries: 5
1717
delay: 3
1818

0 commit comments

Comments
 (0)