File tree Expand file tree Collapse file tree
components/renku_data_services/notebooks/api/classes
test/bases/renku_data_services/data_api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434 " ghcr.io/devcontainers-contrib/features/poetry" ,
3535 " ghcr.io/devcontainers-contrib/features/bash-command"
3636 ],
37- "postCreateCommand" : " poetry install --with dev" ,
37+ "postCreateCommand" : " poetry install --with dev && mkdir -p /home/vscode/.config/k9s " ,
3838 "customizations" : {
3939 "vscode" : {
4040 "extensions" : [
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ services:
2525 POETRY_CACHE_DIR : " /poetry_cache"
2626 NB_SERVER_OPTIONS__DEFAULTS_PATH : /workspace/server_defaults.json
2727 NB_SERVER_OPTIONS__UI_CHOICES_PATH : /workspace/server_options.json
28+ KUBECONFIG : " /workspace/.k3d-config.yaml"
2829 network_mode : service:db
2930 depends_on :
3031 - db
Original file line number Diff line number Diff line change @@ -79,3 +79,5 @@ docker-compose.override.yml
7979# nix
8080result
8181* .qcow2
82+
83+ .k3d-config.yaml
Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ class ImageRepoDockerAPI:
3030 hostname : str
3131 oauth2_token : Optional [str ] = field (default = None , repr = False )
3232 # NOTE: We need to follow redirects so that we can authenticate with the image repositories properly.
33- client : httpx .AsyncClient = httpx .AsyncClient (timeout = 10 , follow_redirects = True )
33+ # NOTE: If we do not use default_factory to create the client here requests will fail beause it can happen
34+ # that the client gets created in the wrong asyncio loop.
35+ client : httpx .AsyncClient = field (default_factory = lambda : httpx .AsyncClient (timeout = 10 , follow_redirects = True ))
3436
3537 async def _get_docker_token (self , image : "Image" ) -> Optional [str ]:
3638 """Get an authorization token from the docker v2 API.
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ ignore = [
150150"components/renku_data_services/notebooks/crs.py" = [" F401" ]
151151
152152[tool .ruff .lint .isort ]
153- known-first-party = [" renku_data_services" ]
153+ known-first-party = [" renku_data_services" , " test " ]
154154
155155[tool .ruff .lint .pydocstyle ]
156156convention = " google"
Original file line number Diff line number Diff line change 33import asyncio
44import os
55import shutil
6- from collections .abc import AsyncIterator
6+ from collections .abc import AsyncIterator , Iterator
77from unittest .mock import MagicMock
88from uuid import uuid4
99
1313from sanic_testing .testing import SanicASGITestClient
1414
1515from renku_data_services .notebooks .api .classes .k8s_client import JupyterServerV1Alpha1Kr8s
16-
17- from .utils import K3DCluster , setup_amalthea
18-
19- os .environ ["KUBECONFIG" ] = ".k3d-config.yaml"
16+ from test .bases .renku_data_services .data_api .utils import K3DCluster , setup_amalthea
2017
2118
2219@pytest .fixture (scope = "module" , autouse = True )
23- def cluster () -> K3DCluster :
20+ def cluster () -> Iterator [K3DCluster ]:
21+ os .environ ["KUBECONFIG" ] = ".k3d-config.yaml"
2422 if shutil .which ("k3d" ) is None :
2523 pytest .skip ("Requires k3d for cluster creation" )
2624
Original file line number Diff line number Diff line change 1313from renku_data_services .app_config .config import Config
1414from renku_data_services .crc .apispec import ResourcePool
1515from renku_data_services .users .models import UserInfo
16-
17- from .utils import K3DCluster , setup_amalthea
18-
19- os .environ ["KUBECONFIG" ] = ".k3d-config.yaml"
16+ from test .bases .renku_data_services .data_api .utils import K3DCluster , setup_amalthea
2017
2118
2219@pytest .fixture (scope = "module" )
2320def cluster () -> Iterator [K3DCluster ]:
21+ os .environ ["KUBECONFIG" ] = ".k3d-config.yaml"
2422 if shutil .which ("k3d" ) is None :
2523 pytest .skip ("Requires k3d for cluster creation" )
2624
You can’t perform that action at this time.
0 commit comments