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
2 changes: 1 addition & 1 deletion .github/workflows/SideBySide/config-ssl.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Data": {
"ConnectionString": "server=SINGLESTORE_HOST;user id=SQL_USER_NAME;password=SQL_USER_PASSWORD;port=3306;database=singlestoretest;sslmode=Required;certificate file=../../../../.ci/server/certs/ssl-client.pfx;",
"UnsupportedFeatures": "CachingSha2Password,Ed25519,QueryAttributes,Tls11,Tls13,UuidToBin,UnixDomainSocket,Sha256Password,GlobalLog,Redirection,CancelSleepSuccessfully,TlsFingerprintValidation,ParsecAuthentication",
"UnsupportedFeatures": "CachingSha2Password,Ed25519,QueryAttributes,Tls11,UuidToBin,UnixDomainSocket,Sha256Password,GlobalLog,Redirection,CancelSleepSuccessfully,TlsFingerprintValidation,ParsecAuthentication",
"CertificatesPath": "../../../../.ci/server/certs"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/SideBySide/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Data": {
"ConnectionString": "server=SINGLESTORE_HOST;user id=SQL_USER_NAME;password=SQL_USER_PASSWORD;port=3306;database=singlestoretest;sslmode=disabled;",
"UnsupportedFeatures": "CachingSha2Password,Ed25519,QueryAttributes,Tls11,Tls13,UuidToBin,UnixDomainSocket,Sha256Password,GlobalLog,Redirection,CancelSleepSuccessfully,TlsFingerprintValidation,ParsecAuthentication",
"UnsupportedFeatures": "CachingSha2Password,Ed25519,QueryAttributes,Tls11,UuidToBin,UnixDomainSocket,Sha256Password,GlobalLog,Redirection,CancelSleepSuccessfully,TlsFingerprintValidation,ParsecAuthentication",
"ManagedService": true
}
}
37 changes: 19 additions & 18 deletions tests/SideBySide/SslTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,30 +280,31 @@ public async Task ConnectSslTlsVersion()
{
using var connection = new SingleStoreConnection(AppConfig.ConnectionString);
await connection.OpenAsync();
#pragma warning disable SYSLIB0039 // SslProtocols.Tls11 is obsolete
var expectedProtocol = AppConfig.SupportedFeatures.HasFlag(ServerFeatures.Tls12) ? SslProtocols.Tls12 :
AppConfig.SupportedFeatures.HasFlag(ServerFeatures.Tls11) ? SslProtocols.Tls11 :
SslProtocols.Tls;
var expectedProtocolString = expectedProtocol == SslProtocols.Tls12 ? "TLSv1.2" :
expectedProtocol == SslProtocols.Tls11 ? "TLSv1.1" : "TLSv1";
#pragma warning restore SYSLIB0039 // SslProtocols.Tls11 is obsolete

#if !NET462 && !NET472
// https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#tls-13--openssl-111-on-linux
if (expectedProtocol == SslProtocols.Tls12 && AppConfig.SupportedFeatures.HasFlag(ServerFeatures.Tls13) && RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
using var cmd = new SingleStoreCommand("SHOW SESSION STATUS LIKE 'Ssl_version';", connection);
using var reader = await cmd.ExecuteReaderAsync();

Assert.True(await reader.ReadAsync());
var serverProtocol = reader.GetString(1);

#if !BASELINE
#pragma warning disable SYSLIB0039 // Older TLS protocols are obsolete
var expectedProtocol = serverProtocol switch
{
expectedProtocol = SslProtocols.Tls13;
expectedProtocolString = "TLSv1.3";
}
#if !NET462 && !NET472
"TLSv1.3" => SslProtocols.Tls13,
#endif
"TLSv1.2" => SslProtocols.Tls12,
"TLSv1.1" => SslProtocols.Tls11,
"TLSv1" => SslProtocols.Tls,
_ => throw new NotSupportedException($"Unexpected TLS protocol: {serverProtocol}"),
};
#pragma warning restore SYSLIB0039

#if !BASELINE
Assert.Equal(expectedProtocol, connection.SslProtocol);
#else
Assert.False(string.IsNullOrWhiteSpace(serverProtocol));
#endif
using var cmd = new SingleStoreCommand("show status like 'Ssl_version';", connection);
using var reader = await cmd.ExecuteReaderAsync();
Assert.True(reader.Read());
Assert.Equal(expectedProtocolString, reader.GetString(1));
}

#if !NET5_0_OR_GREATER
Expand Down
Loading