mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Replace chp with traefik-proxy
This commit is contained in:
@@ -75,6 +75,7 @@ def test_add_to_config_zero_level():
|
||||
'a': ['b']
|
||||
}
|
||||
|
||||
|
||||
def test_add_to_config_multiple():
|
||||
conf = {}
|
||||
|
||||
@@ -116,15 +117,17 @@ def test_remove_from_config_error():
|
||||
|
||||
|
||||
def test_reload_hub():
|
||||
with mock.patch('tljh.systemd.restart_service') as restart_service:
|
||||
with mock.patch('tljh.systemd.restart_service') as restart_service, mock.patch(
|
||||
'tljh.systemd.check_service_active'
|
||||
) as check_active, mock.patch('tljh.systemd.check_hub_ready') as check_ready:
|
||||
config.reload_component('hub')
|
||||
assert restart_service.called_with('jupyterhub')
|
||||
assert check_active.called_with('jupyterhub')
|
||||
|
||||
|
||||
def test_reload_proxy(tljh_dir):
|
||||
with mock.patch('tljh.systemd.restart_service') as restart_service:
|
||||
config.reload_component('proxy')
|
||||
assert restart_service.called_with('configurable-http-proxy')
|
||||
assert restart_service.called_with('traefik')
|
||||
assert os.path.exists(os.path.join(config.STATE_DIR, 'traefik.toml'))
|
||||
|
||||
@@ -140,8 +143,8 @@ def test_cli_no_command(capsys):
|
||||
"arg, value",
|
||||
[
|
||||
("true", True),
|
||||
("FALSE", False),
|
||||
],
|
||||
("FALSE", False)
|
||||
]
|
||||
)
|
||||
def test_cli_set_bool(tljh_dir, arg, value):
|
||||
config.main(["set", "https.enabled", arg])
|
||||
|
||||
@@ -27,12 +27,14 @@ def test_default_config(tmpdir, tljh_dir):
|
||||
print(toml_cfg)
|
||||
cfg = toml.loads(toml_cfg)
|
||||
assert cfg["defaultEntryPoints"] == ["http"]
|
||||
assert cfg["entryPoints"] == {"http": {"address": ":80"}}
|
||||
assert cfg["frontends"] == {
|
||||
"jupyterhub": {"backend": "jupyterhub", "passHostHeader": True}
|
||||
}
|
||||
assert cfg["backends"] == {
|
||||
"jupyterhub": {"servers": {"chp": {"url": "http://127.0.0.1:15003"}}}
|
||||
assert cfg["entryPoints"] == {
|
||||
"http": {"address": ":80"},
|
||||
"auth_api": {
|
||||
"address": ":8099",
|
||||
"auth": {
|
||||
"basic": {"users": ["api_admin:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./"]}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +59,13 @@ def test_letsencrypt_config(tljh_dir):
|
||||
assert "acme" in cfg
|
||||
assert cfg["entryPoints"] == {
|
||||
"http": {"address": ":80", "redirect": {"entryPoint": "https"}},
|
||||
"https": {"address": ":443", "backend": "jupyterhub", "tls": {}},
|
||||
"https": {"address": ":443", "tls": {}},
|
||||
"auth_api": {
|
||||
"address": ":8099",
|
||||
"auth": {
|
||||
"basic": {"users": ["api_admin:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./"]}
|
||||
},
|
||||
},
|
||||
}
|
||||
assert cfg["acme"] == {
|
||||
"email": "fake@jupyter.org",
|
||||
@@ -87,11 +95,16 @@ def test_manual_ssl_config(tljh_dir):
|
||||
"http": {"address": ":80", "redirect": {"entryPoint": "https"}},
|
||||
"https": {
|
||||
"address": ":443",
|
||||
"backend": "jupyterhub",
|
||||
"tls": {
|
||||
"certificates": [
|
||||
{"certFile": "/path/to/ssl.cert", "keyFile": "/path/to/ssl.key"}
|
||||
]
|
||||
},
|
||||
},
|
||||
"auth_api": {
|
||||
"address": ":8099",
|
||||
"auth": {
|
||||
"basic": {"users": ["api_admin:$apr1$eS/j3kum$q/X2khsIEG/bBGsteP.x./"]}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user