Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion contract-tests/async_client_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions contract-tests/async_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
31 changes: 29 additions & 2 deletions contract-tests/client_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions contract-tests/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down
Loading