-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a63eaa1
commit e24ea8b
Showing
4 changed files
with
90 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,8 @@ public void connection_string_with_duplicate_key_should_throw(string connectionS | |
InlineData("esdb://user:[email protected]/?discoveryInterval=abcd"), | ||
InlineData("esdb://user:[email protected]/?gossipTimeout=defg"), | ||
InlineData("esdb://user:[email protected]/?tlsVerifyCert=truee"), | ||
InlineData("esdb://user:[email protected]/?nodePreference=blabla")] | ||
InlineData("esdb://user:[email protected]/?nodePreference=blabla"), | ||
InlineData("esdb://user:[email protected]/?keepAlive=blabla")] | ||
public void connection_string_with_invalid_settings_should_throw(string connectionString) { | ||
Assert.Throws<InvalidSettingException>(() => EventStoreClientSettings.Create(connectionString)); | ||
} | ||
|
@@ -107,10 +108,8 @@ public void with_different_node_preferences(string nodePreference, NodePreferenc | |
|
||
[Fact] | ||
public void with_valid_single_node_connection_string() { | ||
EventStoreClientSettings settings; | ||
|
||
settings = EventStoreClientSettings.Create( | ||
"esdb://user:[email protected]/?maxDiscoverAttempts=13&DiscoveryInterval=37&gossipTimeout=33&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false"); | ||
var settings = EventStoreClientSettings.Create( | ||
"esdb://user:[email protected]/?maxDiscoverAttempts=13&DiscoveryInterval=37&gossipTimeout=33&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false&keepAlive=10"); | ||
Assert.Equal("user", settings.DefaultCredentials.Username); | ||
Assert.Equal("pass", settings.DefaultCredentials.Password); | ||
Assert.Equal("https://127.0.0.1:2113/", settings.ConnectivitySettings.Address.ToString()); | ||
|
@@ -121,14 +120,15 @@ public void with_valid_single_node_connection_string() { | |
Assert.Equal(37, settings.ConnectivitySettings.DiscoveryInterval.TotalMilliseconds); | ||
Assert.Equal(33, settings.ConnectivitySettings.GossipTimeout.TotalMilliseconds); | ||
Assert.Equal(NodePreference.Follower, settings.ConnectivitySettings.NodePreference); | ||
Assert.Equal(TimeSpan.FromMilliseconds(10), settings.ConnectivitySettings.KeepAlive); | ||
#if !GRPC_CORE | ||
#if !GRPC_CORE | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
#endif | ||
|
||
#endif | ||
settings = EventStoreClientSettings.Create( | ||
"esdb://127.0.0.1?connectionName=test&maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tls=true&tlsVerifyCert=true&operationTimeout=330&throwOnAppendFailure=faLse"); | ||
"esdb://127.0.0.1?connectionName=test&maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tls=true&tlsVerifyCert=true&operationTimeout=330&throwOnAppendFailure=faLse&KEepAlive=10"); | ||
Assert.Null(settings.DefaultCredentials); | ||
Assert.Equal("test", settings.ConnectionName); | ||
Assert.Equal("https://127.0.0.1:2113/", settings.ConnectivitySettings.Address.ToString()); | ||
|
@@ -139,8 +139,9 @@ public void with_valid_single_node_connection_string() { | |
Assert.Equal(13, settings.ConnectivitySettings.MaxDiscoverAttempts); | ||
Assert.Equal(37, settings.ConnectivitySettings.DiscoveryInterval.TotalMilliseconds); | ||
Assert.Equal(NodePreference.Follower, settings.ConnectivitySettings.NodePreference); | ||
Assert.Equal(TimeSpan.FromMilliseconds(10), settings.ConnectivitySettings.KeepAlive); | ||
#if !GRPC_CORE | ||
Assert.Null(settings.CreateHttpMessageHandler); | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
#endif | ||
|
||
Assert.Equal(330, settings.OperationOptions.TimeoutAfter.Value.TotalMilliseconds); | ||
|
@@ -153,15 +154,15 @@ public void with_valid_single_node_connection_string() { | |
Assert.Null(settings.ConnectivitySettings.IpGossipSeeds); | ||
Assert.Null(settings.ConnectivitySettings.DnsGossipSeeds); | ||
Assert.True(settings.ConnectivitySettings.GossipOverHttps); | ||
Assert.Null(settings.ConnectivitySettings.KeepAlive); | ||
#if !GRPC_CORE | ||
Assert.Null(settings.CreateHttpMessageHandler); | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
#endif | ||
} | ||
|
||
[Fact] | ||
public void with_default_settings() { | ||
EventStoreClientSettings settings; | ||
settings = EventStoreClientSettings.Create("esdb://hostname:4321/"); | ||
var settings = EventStoreClientSettings.Create("esdb://hostname:4321/"); | ||
|
||
Assert.Null(settings.ConnectionName); | ||
Assert.Equal(EventStoreClientConnectivitySettings.Default.Address.Scheme, | ||
|
@@ -179,18 +180,18 @@ public void with_default_settings() { | |
settings.ConnectivitySettings.NodePreference); | ||
Assert.Equal(EventStoreClientConnectivitySettings.Default.GossipOverHttps, | ||
settings.ConnectivitySettings.GossipOverHttps); | ||
Assert.Equal(EventStoreClientOperationOptions.Default.TimeoutAfter.Value.TotalMilliseconds, | ||
settings.OperationOptions.TimeoutAfter.Value.TotalMilliseconds); | ||
Assert.Equal(EventStoreClientOperationOptions.Default.TimeoutAfter!.Value.TotalMilliseconds, | ||
settings.OperationOptions.TimeoutAfter!.Value.TotalMilliseconds); | ||
Assert.Equal(EventStoreClientOperationOptions.Default.ThrowOnAppendFailure, | ||
settings.OperationOptions.ThrowOnAppendFailure); | ||
Assert.Equal(EventStoreClientConnectivitySettings.Default.KeepAlive, | ||
settings.ConnectivitySettings.KeepAlive); | ||
} | ||
|
||
[Fact] | ||
public void with_valid_cluster_connection_string() { | ||
EventStoreClientSettings settings; | ||
|
||
settings = EventStoreClientSettings.Create( | ||
"esdb://user:[email protected],127.0.0.2:3321,127.0.0.3/?maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false"); | ||
var settings = EventStoreClientSettings.Create( | ||
"esdb://user:[email protected],127.0.0.2:3321,127.0.0.3/?maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false&KEepAlive=10"); | ||
Assert.Equal("user", settings.DefaultCredentials.Username); | ||
Assert.Equal("pass", settings.DefaultCredentials.Password); | ||
Assert.NotEmpty(settings.ConnectivitySettings.GossipSeeds); | ||
|
@@ -207,13 +208,14 @@ public void with_valid_cluster_connection_string() { | |
Assert.Equal(13, settings.ConnectivitySettings.MaxDiscoverAttempts); | ||
Assert.Equal(37, settings.ConnectivitySettings.DiscoveryInterval.TotalMilliseconds); | ||
Assert.Equal(NodePreference.Follower, settings.ConnectivitySettings.NodePreference); | ||
Assert.Equal(TimeSpan.FromMilliseconds(10), settings.ConnectivitySettings.KeepAlive); | ||
#if !GRPC_CORE | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
#endif | ||
|
||
|
||
settings = EventStoreClientSettings.Create( | ||
"esdb://user:pass@host1,host2:3321,127.0.0.3/?tls=false&maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false"); | ||
"esdb://user:pass@host1,host2:3321,127.0.0.3/?tls=false&maxDiscoverAttempts=13&DiscoveryInterval=37&nOdEPrEfErence=FoLLoWer&tlsVerifyCert=false&KEepAlive=10"); | ||
Assert.Equal("user", settings.DefaultCredentials.Username); | ||
Assert.Equal("pass", settings.DefaultCredentials.Password); | ||
Assert.NotEmpty(settings.ConnectivitySettings.GossipSeeds); | ||
|
@@ -230,6 +232,7 @@ public void with_valid_cluster_connection_string() { | |
Assert.Equal(13, settings.ConnectivitySettings.MaxDiscoverAttempts); | ||
Assert.Equal(37, settings.ConnectivitySettings.DiscoveryInterval.TotalMilliseconds); | ||
Assert.Equal(NodePreference.Follower, settings.ConnectivitySettings.NodePreference); | ||
Assert.Equal(TimeSpan.FromMilliseconds(10), settings.ConnectivitySettings.KeepAlive); | ||
#if !GRPC_CORE | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
#endif | ||
|
@@ -264,19 +267,19 @@ public void with_different_tls_verify_cert_settings() { | |
EventStoreClientSettings settings; | ||
|
||
settings = EventStoreClientSettings.Create("esdb://127.0.0.1/"); | ||
Assert.Null(settings.CreateHttpMessageHandler); | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
|
||
settings = EventStoreClientSettings.Create("esdb://127.0.0.1/?tlsVerifyCert=TrUe"); | ||
Assert.Null(settings.CreateHttpMessageHandler); | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
|
||
settings = EventStoreClientSettings.Create("esdb://127.0.0.1/?tlsVerifyCert=FaLsE"); | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
|
||
settings = EventStoreClientSettings.Create("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/"); | ||
Assert.Null(settings.CreateHttpMessageHandler); | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
|
||
settings = EventStoreClientSettings.Create("esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tlsVerifyCert=true"); | ||
Assert.Null(settings.CreateHttpMessageHandler); | ||
Assert.NotNull(settings.CreateHttpMessageHandler); | ||
|
||
settings = EventStoreClientSettings.Create( | ||
"esdb://127.0.0.1,127.0.0.2:3321,127.0.0.3/?tlsVerifyCert=false"); | ||
|