diff --git a/contract-tests/async_client_entity.py b/contract-tests/async_client_entity.py index 0698639b..30708349 100644 --- a/contract-tests/async_client_entity.py +++ b/contract-tests/async_client_entity.py @@ -16,6 +16,7 @@ AsyncConfig, AsyncDataSystemConfig ) +from ldclient.config import HTTPConfig from ldclient.feature_store import CacheConfig from ldclient.impl.datasourcev2.async_polling import ( AsyncFallbackToFDv1PollingDataSourceBuilder, @@ -55,6 +56,31 @@ async def start(self): 'version': tags.get('applicationVersion', ''), } + wrapper = config_params.get('wrapper') or {} + if wrapper.get('name'): + opts['wrapper_name'] = wrapper['name'] + if wrapper.get('version'): + opts['wrapper_version'] = wrapper['version'] + + http_opts = {} + tls = config_params.get('tls') or {} + if tls.get('skipVerifyPeer', False): + http_opts['disable_ssl_verification'] = True + proxy = config_params.get('proxy') or {} + if proxy.get('httpProxy'): + http_opts['http_proxy'] = proxy['httpProxy'] + if http_opts: + opts['http'] = HTTPConfig(**http_opts) + + # Per-component base URIs below take precedence over these. + endpoints = config_params.get('serviceEndpoints') or {} + if endpoints.get('streaming'): + opts['stream_uri'] = endpoints['streaming'] + if endpoints.get('polling'): + opts['base_uri'] = endpoints['polling'] + if endpoints.get('events'): + opts['events_uri'] = endpoints['events'] + datasystem_config = config_params.get('dataSystem') if datasystem_config is not None: opts["datasystem_config"] = _build_async_data_system(datasystem_config, opts) @@ -73,7 +99,9 @@ async def start(self): if polling.get("filter") is not None: opts["payload_filter_key"] = polling["filter"] _set_optional_time_prop(polling, "pollIntervalMs", opts, "poll_interval") - else: + elif not endpoints.get('streaming') and not endpoints.get('polling'): + # No data source config and no streaming or polling endpoint means daemon mode. + # A config that sets only an endpoint gets the default streaming data source. opts['use_ldd'] = True if config_params.get("events") is not None: diff --git a/contract-tests/async_service.py b/contract-tests/async_service.py index 65e9be5c..ac87e64b 100644 --- a/contract-tests/async_service.py +++ b/contract-tests/async_service.py @@ -71,6 +71,10 @@ async def handle_status(request: aiohttp.web.Request) -> aiohttp.web.Response: 'fdv1-fallback', 'retry-conformance-fdv1-streaming', 'retry-conformance-fdv1-polling', + 'service-endpoints', + 'wrapper', + 'http-proxy', + 'tls:skip-verify-peer', ] } return aiohttp.web.Response( diff --git a/contract-tests/client_entity.py b/contract-tests/client_entity.py index f93b5d85..cb8caf79 100644 --- a/contract-tests/client_entity.py +++ b/contract-tests/client_entity.py @@ -18,7 +18,7 @@ Operation, Stage ) -from ldclient.config import BigSegmentsConfig +from ldclient.config import BigSegmentsConfig, HTTPConfig from ldclient.datasystem import ( custom, fdv1_fallback_ds_builder, @@ -43,6 +43,31 @@ def __init__(self, tag, config): 'version': tags.get('applicationVersion', ''), } + wrapper = config.get('wrapper') or {} + if wrapper.get('name'): + opts['wrapper_name'] = wrapper['name'] + if wrapper.get('version'): + opts['wrapper_version'] = wrapper['version'] + + http_opts = {} + tls = config.get('tls') or {} + if tls.get('skipVerifyPeer', False): + http_opts['disable_ssl_verification'] = True + proxy = config.get('proxy') or {} + if proxy.get('httpProxy'): + http_opts['http_proxy'] = proxy['httpProxy'] + if http_opts: + opts['http'] = HTTPConfig(**http_opts) + + # Per-component base URIs below take precedence over these. + endpoints = config.get('serviceEndpoints') or {} + if endpoints.get('streaming'): + opts['stream_uri'] = endpoints['streaming'] + if endpoints.get('polling'): + opts['base_uri'] = endpoints['polling'] + if endpoints.get('events'): + opts['events_uri'] = endpoints['events'] + datasystem_config = config.get('dataSystem') if datasystem_config is not None: datasystem = custom() @@ -124,7 +149,9 @@ def __init__(self, tag, config): if polling.get("filter") is not None: opts["payload_filter_key"] = polling["filter"] _set_optional_time_prop(polling, "pollIntervalMs", opts, "poll_interval") - else: + elif not endpoints.get('streaming') and not endpoints.get('polling'): + # No data source config and no streaming or polling endpoint means daemon mode. + # A config that sets only an endpoint gets the default streaming data source. opts['use_ldd'] = True if config.get("events") is not None: diff --git a/contract-tests/service.py b/contract-tests/service.py index 260fb77b..4631fdee 100644 --- a/contract-tests/service.py +++ b/contract-tests/service.py @@ -88,6 +88,10 @@ def status(): 'fdv1-fallback', 'retry-conformance-fdv1-streaming', 'retry-conformance-fdv1-polling', + 'service-endpoints', + 'wrapper', + 'http-proxy', + 'tls:skip-verify-peer', ] } return json.dumps(body), 200, {'Content-type': 'application/json'}