Skip to content

Commit

Permalink
Test refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashant Tiwari committed May 10, 2024
1 parent 9cec9cf commit df63165
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/tests_deployment/test_conda_store_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ def patched_secret_token(configuration):
elevated_token = str(uuid.uuid4())

# Get secret
api_response = api_instance.read_namespaced_secret(name, namespace)
api_response_data = api_response.data
secret_data = api_response_data["config.json"]
secret_config = json.loads(base64.b64decode(secret_data))
api_response, secret_config = get_conda_secret(api_instance, name, namespace)

# Update secret
permissions = {
Expand Down Expand Up @@ -70,10 +67,7 @@ def patched_secret_token(configuration):
yield elevated_token, _api_client

# Get update secret
api_response = api_instance.read_namespaced_secret(name, namespace)
api_response_data = api_response.data
secret_data = api_response_data["config.json"]
secret_config = json.loads(base64.b64decode(secret_data))
api_response, secret_config = get_conda_secret(api_instance, name, namespace)

# Update secret
secret_config["service-tokens"].pop(elevated_token)
Expand All @@ -94,6 +88,14 @@ def patched_secret_token(configuration):
api_instance.delete_namespaced_pod(server_pod.metadata.name, namespace)


def get_conda_secret(api_instance, name, namespace):
api_response = api_instance.read_namespaced_secret(name, namespace)
api_response_data = api_response.data
secret_data = api_response_data["config.json"]
secret_config = json.loads(base64.b64decode(secret_data))
return api_response, secret_config


@pytest.mark.filterwarnings("ignore::urllib3.exceptions.InsecureRequestWarning")
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
class TestCondaStoreWorkerHPA(TestCase):
Expand Down

0 comments on commit df63165

Please sign in to comment.