Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-22284 .NET: Fix tests on macOS #3875

Merged
merged 5 commits into from
Jun 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,16 @@ public void TestRegexReplace()

Assert.Multiple(() =>
{
Assert.AreEqual(expectedRes, res);
if (expectedRes is double expectedDoubleRes)
{
// Double-precision results can be a bit different depending on OS and hardware.
Assert.AreEqual(expectedDoubleRes, (double)(object)res!, 1e-15);
}
else
{
Assert.AreEqual(expectedRes, res);
}

StringAssert.Contains(expectedQuery, sql);
});
}
Expand Down
17 changes: 9 additions & 8 deletions modules/platforms/dotnet/Apache.Ignite.Tests/SslTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public async Task TestSslWithoutClientAuthentication()

Assert.IsNotNull(sslInfo);
Assert.IsFalse(sslInfo!.IsMutuallyAuthenticated);
StringAssert.StartsWith("TLS_AES_", sslInfo.NegotiatedCipherSuiteName);
Assert.AreEqual(SslProtocols.Tls13, sslInfo.SslProtocol);
StringAssert.StartsWith("TLS_", sslInfo.NegotiatedCipherSuiteName);
CollectionAssert.Contains(new[] { SslProtocols.Tls13, SslProtocols.Tls12 }, sslInfo.SslProtocol);
Assert.AreEqual("localhost", sslInfo.TargetHostName);
Assert.IsNull(sslInfo.LocalCertificate);
StringAssert.Contains(CertificateIssuer, sslInfo.RemoteCertificate!.Issuer);
Expand Down Expand Up @@ -101,7 +101,7 @@ public async Task TestSslWithClientAuthentication()

Assert.IsNotNull(sslInfo);
Assert.IsTrue(sslInfo!.IsMutuallyAuthenticated);
StringAssert.StartsWith("TLS_AES_", sslInfo.NegotiatedCipherSuiteName);
StringAssert.StartsWith("TLS_", sslInfo.NegotiatedCipherSuiteName);
Assert.AreEqual("127.0.0.1", sslInfo.TargetHostName);
StringAssert.Contains(CertificateIssuer, sslInfo.RemoteCertificate!.Issuer);
StringAssert.Contains(CertificateIssuer, sslInfo.LocalCertificate!.Issuer);
Expand Down Expand Up @@ -180,6 +180,10 @@ public async Task TestSslStreamFactoryReturnsNullDisablesSsl()
[Test]
public async Task TestCustomCipherSuite()
{
var cipherSuite = OperatingSystem.IsMacOS()
? TlsCipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
: TlsCipherSuite.TLS_AES_128_GCM_SHA256;

var cfg = new IgniteClientConfiguration
{
Endpoints = { SslEndpoint },
Expand All @@ -188,10 +192,7 @@ public async Task TestCustomCipherSuite()
SslClientAuthenticationOptions = new SslClientAuthenticationOptions
{
RemoteCertificateValidationCallback = (_, _, _, _) => true,
CipherSuitesPolicy = new CipherSuitesPolicy(new[]
{
TlsCipherSuite.TLS_AES_128_GCM_SHA256
})
CipherSuitesPolicy = new CipherSuitesPolicy(new[] { cipherSuite })
}
}
};
Expand All @@ -203,7 +204,7 @@ public async Task TestCustomCipherSuite()

Assert.IsNotNull(sslInfo);
Assert.IsFalse(sslInfo!.IsMutuallyAuthenticated);
Assert.AreEqual(TlsCipherSuite.TLS_AES_128_GCM_SHA256.ToString(), sslInfo.NegotiatedCipherSuiteName);
Assert.AreEqual(cipherSuite.ToString(), sslInfo.NegotiatedCipherSuiteName);
}

private class NullSslStreamFactory : ISslStreamFactory
Expand Down