Skip to content

Commit 99a79f7

Browse files
committed
Fixed problem with tests failing
1 parent 3251a03 commit 99a79f7

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/app/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ async def lifespan(_app: FastAPI) -> AsyncIterator[None]:
3636
logger, and database before serving requests.
3737
"""
3838
configuration.load_configuration(os.environ["LIGHTSPEED_STACK_CONFIG_PATH"])
39-
logger.info("Creating AsyncLlamaStackClient")
4039
await AsyncLlamaStackClientHolder().load(configuration.configuration.llama_stack)
4140
client = AsyncLlamaStackClientHolder().get_client()
4241
# check if the Llama Stack version is supported by the service

src/authentication/__init__.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
import constants
77
from authentication import jwk_token, k8s, noop, noop_with_token
88
from authentication.interface import AuthInterface
9-
from configuration import configuration
10-
11-
configuration.load_configuration(os.environ["LIGHTSPEED_STACK_CONFIG_PATH"])
9+
from configuration import LogicError, configuration
1210

1311
logger = logging.getLogger(__name__)
1412

@@ -17,9 +15,18 @@ def get_auth_dependency(
1715
virtual_path: str = constants.DEFAULT_VIRTUAL_PATH,
1816
) -> AuthInterface:
1917
"""Select the configured authentication dependency interface."""
20-
module = configuration.authentication_configuration.module
21-
22-
logger.info(
18+
try:
19+
module = configuration.authentication_configuration.module
20+
except LogicError:
21+
# Only load once if not already loaded
22+
config_path = os.getenv(
23+
"LIGHTSPEED_STACK_CONFIG_PATH",
24+
"tests/configuration/lightspeed-stack.yaml",
25+
)
26+
configuration.load_configuration(config_path)
27+
module = configuration.authentication_configuration.module
28+
29+
logger.debug(
2330
"Initializing authentication dependency: module='%s', virtual_path='%s'",
2431
module,
2532
virtual_path,

0 commit comments

Comments
 (0)