Skip to content

Commit

Permalink
Add snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Apr 12, 2024
1 parent 87666c5 commit a3ab92c
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 18 deletions.
5 changes: 2 additions & 3 deletions tljh_repo2docker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,11 @@ def _default_log_level(self):
repo_providers = List(
default_value=[
{"label": "Git", "value": "git"},
{"label": "GitHub", "value": "gh"},
{"label": "Gitlab", "value": "gl"},
],
trait=Dict,
help="""
Dict of available repo providers in the form of {"label":"value"}
Dict of available repo providers in the form of {"label":"value"}.
The references are taken from the binderhub documentation
""",
config=True,
)
Expand Down
9 changes: 7 additions & 2 deletions tljh_repo2docker/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import os
from contextlib import _AsyncGeneratorContextManager
from http.client import responses
from typing import Callable, Dict, List, Optional, Tuple
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple

from httpx import AsyncClient
from jinja2 import Template
Expand All @@ -17,6 +18,10 @@

from .model import UserModel

if sys.version_info >= (3, 9):
AsyncSessionContextFactory = Callable[[], _AsyncGeneratorContextManager[AsyncSession]]
else:
AsyncSessionContextFactory = Any

def require_admin_role(func):
"""decorator to require admin role to perform an action"""
Expand Down Expand Up @@ -179,7 +184,7 @@ def use_binderhub(self) -> bool:
def get_db_handlers(
self,
) -> Tuple[
Optional[Callable[[], _AsyncGeneratorContextManager[AsyncSession]]],
Optional[AsyncSessionContextFactory],
Optional[ImagesDatabaseManager],
]:
"""
Expand Down
2 changes: 1 addition & 1 deletion tljh_repo2docker/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async def app(hub_app):
{
"description": "Role for tljh_repo2docker service",
"name": "tljh-repo2docker-service",
"scopes": ["read:users", "read:servers", "read:roles:users"],
"scopes": ["read:users", "read:roles:users", "admin:servers"],
"services": ["tljh_repo2docker"],
}
]
Expand Down
2 changes: 1 addition & 1 deletion tljh_repo2docker/tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async def test_images_list_admin(app):
)
r.raise_for_status()
assert (
'{"images": [], "default_mem_limit": "None", "default_cpu_limit":"None", "machine_profiles": []}'
'{"repo_providers": [{"label": "Git", "value": "git"}], "use_binderhub": false, "images": [], "default_mem_limit": "None", "default_cpu_limit":"None", "machine_profiles": []}'
in r.text
)

Expand Down
16 changes: 9 additions & 7 deletions ui-tests/binderhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
c.BinderHub.auth_enabled = True
c.BinderHub.enable_api_only_mode = True

c.BinderHub.use_registry = os.getenv("BINDERHUB_USE_REGISTRY", False)
c.BinderHub.image_prefix = os.getenv(
"BINDERHUB_IMAGE_PREFIX", ""
) # https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-binderhub.html#id2
c.DockerRegistry.auth_config_url = "https://index.docker.io/v1/"
c.BuildExecutor.push_secret = "*" #
use_registry = bool(os.getenv("BINDERHUB_USE_REGISTRY", False))
if use_registry:
c.BinderHub.use_registry = use_registry
c.BinderHub.image_prefix = os.getenv(
"BINDERHUB_IMAGE_PREFIX", ""
) # https://binderhub.readthedocs.io/en/latest/zero-to-binderhub/setup-binderhub.html#id2
c.DockerRegistry.auth_config_url = "https://index.docker.io/v1/"

c.BuildExecutor.push_secret = "*" #

c.BinderHub.builder_required = False

c.BinderHub.build_class = LocalRepo2dockerBuild
c.BinderHub.push_secret = ""
c.BinderHub.launch_quota_class = LaunchQuota

c.BinderHub.hub_url_local = "http://localhost:8000"
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.
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.
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.
7 changes: 3 additions & 4 deletions ui-tests/tests/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ test.describe('tljh_repo2docker UI Tests', () => {
.getByRole('button')
.first()
.click();
await page.waitForSelector(
'span:has-text("Successfully tagged python-env:HEAD")',
{ timeout: 600000 }
);
await page.waitForSelector('span:has-text("Successfully tagged")', {
timeout: 600000
});
expect(await page.screenshot()).toMatchSnapshot('environment-console.png', {
maxDiffPixelRatio: 0.05
});
Expand Down

0 comments on commit a3ab92c

Please sign in to comment.