Skip to content

Commit 2c2a7ae

Browse files
committed
fix: docker-compose api-gw config and DS credential handling
- Use duration strings for api-gw cache config (60 -> 1m) - Persist DS password after layout upload via entities PATCH - Fix _patch_ds_credentials to fall back to test_config ds_password risk: low
1 parent e7d4834 commit 2c2a7ae

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,9 @@ services:
515515
GATEWAY_DB_POOL_MIN_IDLE: 0
516516
GATEWAY_DB_POOL_MAX_LIFE_TIME: 300000
517517
ORGANIZATION_CACHE_SIZE: 1000
518-
CACHE_EXPIRE_AFTER_WRITE: 60
518+
CACHE_EXPIRE_AFTER_WRITE: 1m
519519
USER_CACHE_SIZE: 1000
520-
USER_CACHE_EXPIRE_AFTER_WRITE: 60
520+
USER_CACHE_EXPIRE_AFTER_WRITE: 1m
521521
ORGANIZATION_CACHE_METRICS: "true"
522522
USER_CACHE_METRICS: "true"
523523
CALL_FORWARDER_CONNECT_TIMEOUT: 1m

packages/gooddata-sdk/tests/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ def test_config(request):
6060

6161
@pytest.fixture(scope="session", autouse=True)
6262
def _patch_ds_credentials(test_config):
63-
"""Override demo-test-ds password in memory when DS_PASSWORD env var is set.
63+
"""Override demo-test-ds password in memory.
6464
65-
The credentials file (data_sources_credentials.yaml) is read by
66-
_credentials_from_file() and used by put_declarative_data_sources and
67-
test_data_sources_connection. Instead of rewriting the file on disk,
68-
we wrap the static method to patch the returned dict in memory.
65+
The credentials file (data_sources_credentials.yaml) contains a placeholder
66+
value for demo-test-ds. This fixture patches _credentials_from_file() to
67+
replace it with the real password — from DS_PASSWORD env var (staging) or
68+
from the test config ds_password (local).
6969
"""
70-
env_ds_password = os.environ.get("DS_PASSWORD")
71-
if not env_ds_password:
70+
ds_password = os.environ.get("DS_PASSWORD") or test_config.get("ds_password")
71+
if not ds_password:
7272
yield
7373
return
7474

@@ -80,7 +80,7 @@ def _patch_ds_credentials(test_config):
8080
def _patched_credentials_from_file(credentials_path):
8181
credentials = original(credentials_path)
8282
if "demo-test-ds" in credentials:
83-
credentials["demo-test-ds"] = env_ds_password
83+
credentials["demo-test-ds"] = ds_password
8484
return credentials
8585

8686
CatalogDataSourceService._credentials_from_file = _patched_credentials_from_file

packages/tests-support/upload_demo_layout.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,19 @@ def update_layout():
207207
print("Uploading test DS with physical model for demo", flush=True)
208208
rest_op_default("put", f"api/{api_version}/layout/dataSources", data_sources)
209209

210+
# Layout PUT does not persist passwords — set them via entities PATCH
211+
print("Setting data source passwords via entities API...", flush=True)
212+
for ds in data_sources.get("dataSources", []):
213+
ds_id = ds["id"]
214+
ds_password = ds.get("password")
215+
if ds_password:
216+
rest_op_jsonapi(
217+
"patch",
218+
f"api/{api_version}/entities/dataSources/{ds_id}",
219+
{"data": {"id": ds_id, "type": "dataSource", "attributes": {"password": ds_password}}},
220+
)
221+
print(f" Set password for DS '{ds_id}'", flush=True)
222+
210223
# Verify data sources were uploaded with permissions
211224
print("Verifying data source permissions...", flush=True)
212225
result = rest_op_default("get", f"api/{api_version}/layout/dataSources", raise_ex=False)

0 commit comments

Comments
 (0)