-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use . to separate username and servername in object names
separator must not be a safe character or the escape character to avoid collisions '.' is not in the safe char list, but is a valid docker identifier - servername is template variable is escaped, matching username - add raw_servername for the raw value - fix safe_username to be the safe version
- Loading branch information
Showing
6 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
"""Tests for SwarmSpawner""" | ||
|
||
from unittest import mock | ||
|
||
import pytest | ||
from jupyterhub.tests.test_api import add_user, api_request | ||
from jupyterhub.tests.mocking import public_url | ||
from jupyterhub.utils import url_path_join | ||
from tornado.httpclient import AsyncHTTPClient, HTTPRequest | ||
from tornado.httpclient import AsyncHTTPClient | ||
|
||
from dockerspawner import SwarmSpawner | ||
|
||
# Mark all tests in this file as asyncio | ||
pytestmark = pytest.mark.asyncio | ||
|
||
|
||
async def test_start_stop(swarmspawner_configured_app): | ||
app = swarmspawner_configured_app | ||
name = "somebody" | ||
add_user(app.db, app, name=name) | ||
user = app.users[name] | ||
assert isinstance(user.spawner, SwarmSpawner) | ||
server_name = 'also-has@' | ||
spawner = user.spawners[server_name] | ||
assert isinstance(spawner, SwarmSpawner) | ||
token = user.new_api_token() | ||
# start the server | ||
r = await api_request(app, "users", name, "server", method="post") | ||
r = await api_request(app, "users", name, "servers", server_name, method="post") | ||
while r.status_code == 202: | ||
# request again | ||
r = await api_request(app, "users", name, "server", method="post") | ||
r = await api_request(app, "users", name, "servers", server_name, method="post") | ||
assert r.status_code == 201, r.text | ||
|
||
url = url_path_join(public_url(app, user), "api/status") | ||
url = url_path_join(public_url(app, user), server_name, "api/status") | ||
resp = await AsyncHTTPClient().fetch(url, headers={"Authorization": "token %s" % token}) | ||
assert resp.effective_url == url | ||
resp.rethrow() | ||
assert "kernels" in resp.body.decode("utf-8") | ||
assert "kernels" in resp.body.decode("utf-8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters