Skip to content

Commit

Permalink
Try CONDA_STORE_TOKEN from env
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashant Tiwari committed May 5, 2024
1 parent f8e03eb commit d10c05e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/tests_deployment/test_conda_store_scaling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import json
import logging
import os
import sys
import time
import uuid
Expand Down Expand Up @@ -71,6 +72,7 @@ def read_namespaced_config_map(self):
_client.close()

def patch_namespaced_config_map(self, config_map):
self.log(f"Conda store config patched: {config_map}")
with kubernetes.client.ApiClient(self.configuration) as _client:
api_instance = kubernetes.client.CoreV1Api(_client)
try:
Expand All @@ -96,19 +98,21 @@ def setUp(self):
# Get token from pre-defined tokens.
token = self.fetch_token()
self.log.info(f"Authentication token: {token}")
token = os.getenv("CONDA_STORE_TOKEN")
self.headers = {"Authorization": f"Bearer {token}"}
self.log.info(f"Authentication headers: {self.headers}")

# Read conda-store-config
self.config_map = self.read_namespaced_config_map()
self.log(f"Conda store config read: {self.config_map}")

# Patch conda-store-config
self.config_map.data["conda_store_config.py"] = self.config_map.data[
"conda_store_config.py"
].replace(
'{default_namespace}/*": {"viewer"}', '{default_namespace}/*": {"admin"}'
)
self.patch_namespaced_config_map(self.config_map)
# self.patch_namespaced_config_map(self.config_map)

# Patch conda-store-config

Expand Down Expand Up @@ -153,7 +157,7 @@ def tearDown(self):
].replace(
'{default_namespace}/*": {"admin"}', '{default_namespace}/*": {"viewer"}'
)
self.patch_namespaced_config_map(self.config_map)
# self.patch_namespaced_config_map(self.config_map)
self.log.info("Teardown complete.")
self.stream_handler.close()

Expand Down

0 comments on commit d10c05e

Please sign in to comment.