File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 2323def main ():
2424 # Initialize OIDC token cache before any API calls (reuses pytest logic)
2525 setup_token_cache ()
26-
26+
2727 # Parse command-line arguments
2828 parser = argparse .ArgumentParser ()
2929 parser .add_argument (
@@ -34,7 +34,7 @@ def main():
3434 # Create Feldera client using the API URL with OIDC token caching support
3535 api_url = args .api_url
3636 print (f"Feldera API URL: { api_url } " )
37-
37+
3838 # Get effective API key (OIDC token takes precedence over static API key)
3939 # This reuses the same token caching infrastructure as the Python test suite
4040 effective_api_key = _get_effective_api_key ()
@@ -50,7 +50,7 @@ def main():
5050 headers = {"Accept" : "application/json" }
5151 if effective_api_key :
5252 headers ["Authorization" ] = f"Bearer { effective_api_key } "
53-
53+
5454 demos = requests .get (f"{ api_url } /v0/config/demos" , headers = headers ).json ()
5555 print (f"Total { len (demos )} packages demos were found and will be run" )
5656 for demo in demos :
Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ def parse_cached_token(env_token: str) -> Optional[Dict[str, Any]]:
197197 """
198198 try :
199199 import base64
200+
200201 token_json = base64 .b64decode (env_token .encode ()).decode ()
201202 token_data = json .loads (token_json )
202203 return token_data
@@ -240,11 +241,14 @@ def encode_token_for_env(token_data: Dict[str, Any]) -> str:
240241 Base64-encoded JSON string suitable for environment variable storage
241242 """
242243 import base64
244+
243245 token_json = json .dumps (token_data )
244246 return base64 .b64encode (token_json .encode ()).decode ()
245247
246248
247- def get_cached_token_from_env (env_var_name : str = "FELDERA_PYTEST_OIDC_TOKEN" ) -> Optional [Dict [str , Any ]]:
249+ def get_cached_token_from_env (
250+ env_var_name : str = "FELDERA_PYTEST_OIDC_TOKEN" ,
251+ ) -> Optional [Dict [str , Any ]]:
248252 """
249253 Retrieve and validate cached token from environment variable.
250254
Original file line number Diff line number Diff line change 66"""
77
88import pytest
9- import os
109
1110
1211def is_master (config ) -> bool :
1312 """True if the code running is in the xdist master node or not using xdist at all."""
1413 return not hasattr (config , "workerinput" )
1514
1615
17-
18-
1916def pytest_configure (config ):
2017 """Configure hook: fetch OIDC token on master node only."""
2118 if is_master (config ):
2219 # This runs only on the master node (or in single-node mode)
2320 from feldera .testutils_oidc import setup_token_cache
21+
2422 token_data = setup_token_cache ()
2523 if token_data :
2624 print ("🔐 AUTH: Master node cached OIDC token for distribution to workers" )
@@ -46,7 +44,7 @@ def oidc_token_fixture(request):
4644 in environment variables for cross-process access.
4745 """
4846 from feldera .testutils_oidc import get_cached_token_from_env
49-
47+
5048 # Token is accessed via environment variable - this fixture just verifies setup
5149 token_data = get_cached_token_from_env ()
5250 if token_data :
You can’t perform that action at this time.
0 commit comments