@@ -87,6 +87,7 @@ class ConnectionTestSuite:
8787 'test_valid_connection_strings' ,
8888 'test_wan_config_profile' ,
8989 'test_wan_config_profile_with_auth' ,
90+ 'test_cluster_options_core_round_trip' ,
9091 ]
9192
9293 def test_cluster_auth_fail (self , couchbase_config ):
@@ -381,6 +382,80 @@ def test_cluster_options(self, couchbase_config):
381382 assert cluster_opts == expected_opts
382383 assert user_agent == f'python/{ platform .python_version ()} '
383384
385+ # creating a new connection, allow retries
386+ @pytest .mark .flaky (reruns = 5 , reruns_delay = 1 )
387+ def test_cluster_options_core_round_trip (self , couchbase_config ):
388+ # Validates that ClusterOptions are correctly propagated into the C++ core by
389+ # creating a real connection and checking get_connection_info().
390+ #
391+ # Options intentionally excluded from this test (validated at Python layer only
392+ # in test_cluster_options via skip_connect):
393+ # - trust_store_path: requires a TLS-capable server and a valid cert file on disk
394+ # - network ('external'): may route to unreachable endpoints in test environments
395+ # - enable_tracing / enable_metrics / enable_orphan_reporting: tracing/metrics options
396+ # are validated in test_cluster_tracing_options* and test_cluster_metrics_options*
397+ # - app_telemetry_endpoint: omitted because enable_app_telemetry is disabled here
398+ # - num_io_threads: not a cluster_options field; passed as a connection-level parameter
399+ opts = {
400+ 'enable_tls' : False ,
401+ 'tls_verify' : TLSVerifyMode .NO_VERIFY ,
402+ 'ip_protocol' : IpProtocol .Any ,
403+ 'enable_dns_srv' : False ,
404+ 'enable_mutation_tokens' : True ,
405+ 'enable_tcp_keep_alive' : True ,
406+ 'enable_compression' : True ,
407+ 'show_queries' : True ,
408+ 'enable_unordered_execution' : False ,
409+ 'enable_clustermap_notification' : False ,
410+ 'disable_mozilla_ca_certificates' : False ,
411+ 'tcp_keep_alive_interval' : timedelta (seconds = 30 ),
412+ 'config_poll_interval' : timedelta (seconds = 30 ),
413+ 'config_poll_floor' : timedelta (seconds = 5 ),
414+ 'max_http_connections' : 5 ,
415+ 'dump_configuration' : True ,
416+ 'preferred_server_group' : 'test_group' ,
417+ 'enable_app_telemetry' : False ,
418+ 'allow_enterprise_analytics' : True ,
419+ 'app_telemetry_backoff' : timedelta (seconds = 10 ),
420+ 'app_telemetry_ping_interval' : timedelta (seconds = 60 ),
421+ 'app_telemetry_ping_timeout' : timedelta (seconds = 5 ),
422+ }
423+
424+ expected = {
425+ 'enable_tls' : False ,
426+ 'tls_verify' : 'none' ,
427+ 'use_ip_protocol' : 'any' ,
428+ 'enable_dns_srv' : False ,
429+ 'enable_mutation_tokens' : True ,
430+ 'enable_tcp_keep_alive' : True ,
431+ 'enable_compression' : True ,
432+ 'show_queries' : True ,
433+ 'enable_unordered_execution' : False ,
434+ 'enable_clustermap_notification' : False ,
435+ 'disable_mozilla_ca_certificates' : False ,
436+ 'tcp_keep_alive_interval' : 30000 ,
437+ 'config_poll_interval' : 30000 ,
438+ 'config_poll_floor' : 5000 ,
439+ 'max_http_connections' : 5 ,
440+ 'dump_configuration' : True ,
441+ 'preferred_server_group' : 'test_group' ,
442+ 'enable_app_telemetry' : False ,
443+ 'allow_enterprise_analytics' : True ,
444+ 'app_telemetry_backoff' : 10000 ,
445+ 'app_telemetry_ping_interval' : 60000 ,
446+ 'app_telemetry_ping_timeout' : 5000 ,
447+ }
448+
449+ conn_string = couchbase_config .get_connection_string ()
450+ username , pw = couchbase_config .get_username_and_pw ()
451+ auth = PasswordAuthenticator (username , pw )
452+ cluster = Cluster .connect (conn_string , ClusterOptions (auth , ** opts ))
453+ client_opts = cluster ._impl .get_connection_info ()
454+ for key , expected_value in expected .items ():
455+ assert client_opts .get (key ) == expected_value , (
456+ f'Expected { key } ={ expected_value !r} , got { client_opts .get (key )!r} '
457+ )
458+
384459 def test_cluster_pw_auth (self , couchbase_config ):
385460 conn_string = couchbase_config .get_connection_string ()
386461 username , pw = couchbase_config .get_username_and_pw ()
0 commit comments