Skip to content

Commit 1b236fa

Browse files
committed
refactor: replace MonitoringBasicAuth with DeploymentAuth and update imports
1 parent b5bb8c0 commit 1b236fa

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import Annotated
2+
3+
from pydantic import Field, SecretStr
4+
from pydantic_settings import BaseSettings
5+
6+
7+
class DeploymentAuth(BaseSettings):
8+
SC_USER_NAME: Annotated[str, Field(examples=["<your username>"])]
9+
SC_PASSWORD: Annotated[SecretStr, Field(examples=["<your password>"])]
10+
11+
def to_auth(self) -> tuple[str, str]:
12+
return (self.SC_USER_NAME, self.SC_PASSWORD.get_secret_value())
13+
14+
15+
class OsparcAuth(BaseSettings):
16+
OSPARC_USER_NAME: Annotated[str, Field(examples=["<your username>"])]
17+
OSPARC_PASSWORD: Annotated[SecretStr, Field(examples=["<your password>"])]

tests/performance2/common/deploy_auth.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/performance2/locustfiles/deployment_max_rps_single_endpoint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
import logging
1212

1313
import locust_plugins
14-
from common.deploy_auth import MonitoringBasicAuth, OsparcAuth
1514
from locust import events, task
1615
from locust.contrib.fasthttp import FastHttpUser
1716

17+
from tests.performance2.common.auth_settings import DeploymentAuth, OsparcAuth
18+
1819
logging.basicConfig(level=logging.INFO)
1920

2021
# NOTE: 'import locust_plugins' is necessary to use --check-fail-ratio
@@ -50,7 +51,7 @@ def _(environment, **_kwargs) -> None:
5051
class WebApiUser(FastHttpUser):
5152
def __init__(self, *args, **kwargs):
5253
super().__init__(*args, **kwargs)
53-
self.auth = MonitoringBasicAuth().to_auth()
54+
self.auth = DeploymentAuth().to_auth()
5455
self.endpoint = _endpoint_holder["endpoint"]
5556
self.osparc_auth = OsparcAuth()
5657
self.requires_login = False

0 commit comments

Comments
 (0)