diff --git a/Snowflake.Data.Tests/IntegrationTests/EasyLoggingIT.cs b/Snowflake.Data.Tests/IntegrationTests/EasyLoggingIT.cs index 595fbb65d..f8e8a35d8 100644 --- a/Snowflake.Data.Tests/IntegrationTests/EasyLoggingIT.cs +++ b/Snowflake.Data.Tests/IntegrationTests/EasyLoggingIT.cs @@ -24,7 +24,7 @@ public static void BeforeAll() Directory.CreateDirectory(s_workingDirectory); } } - + [OneTimeTearDown] public static void AfterAll() { @@ -36,7 +36,7 @@ public static void AfterEach() { EasyLoggingStarter.Instance.Reset(EasyLoggingLogLevel.Warn); } - + [Test] public void TestEnableEasyLogging() { @@ -48,7 +48,7 @@ public void TestEnableEasyLogging() // act conn.Open(); - + // assert Assert.IsTrue(EasyLoggerManager.HasEasyLoggingAppender()); } @@ -65,31 +65,27 @@ public void TestFailToEnableEasyLoggingForWrongConfiguration() // act var thrown = Assert.Throws(() => conn.Open()); - + // assert Assert.That(thrown.Message, Does.Contain("Connection string is invalid: Unable to connect")); Assert.IsFalse(EasyLoggerManager.HasEasyLoggingAppender()); } } - + [Test] + [Platform(Exclude="Win", Reason="skip test on Windows")] public void TestFailToEnableEasyLoggingWhenConfigHasWrongPermissions() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - Assert.Ignore("skip test on Windows"); - } - // arrange var configFilePath = CreateConfigTempFile(s_workingDirectory, Config("WARN", s_workingDirectory)); Syscall.chmod(configFilePath, FilePermissions.S_IRUSR | FilePermissions.S_IWUSR | FilePermissions.S_IWGRP); using (IDbConnection conn = new SnowflakeDbConnection()) { conn.ConnectionString = ConnectionString + $"CLIENT_CONFIG_FILE={configFilePath}"; - + // act var thrown = Assert.Throws(() => conn.Open()); - + // assert Assert.That(thrown.Message, Does.Contain("Connection string is invalid: Unable to connect")); Assert.IsFalse(EasyLoggerManager.HasEasyLoggingAppender()); @@ -97,22 +93,18 @@ public void TestFailToEnableEasyLoggingWhenConfigHasWrongPermissions() } [Test] + [Platform(Exclude="Win", Reason="skip test on Windows")] public void TestFailToEnableEasyLoggingWhenLogDirectoryNotAccessible() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - Assert.Ignore("skip test on Windows"); - } - // arrange var configFilePath = CreateConfigTempFile(s_workingDirectory, Config("WARN", "/")); using (IDbConnection conn = new SnowflakeDbConnection()) { conn.ConnectionString = ConnectionString + $"CLIENT_CONFIG_FILE={configFilePath}"; - + // act var thrown = Assert.Throws(() => conn.Open()); - + // assert Assert.That(thrown.Message, Does.Contain("Connection string is invalid: Unable to connect")); Assert.That(thrown.InnerException.Message, Does.Contain("Failed to create logs directory")); @@ -121,4 +113,4 @@ public void TestFailToEnableEasyLoggingWhenLogDirectoryNotAccessible() } } -} \ No newline at end of file +} diff --git a/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs b/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs index 4fbb1c729..f11dabdd2 100644 --- a/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs +++ b/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs @@ -111,7 +111,7 @@ private void CheckIfValidPermissions(FileStream fileStream, string filePath) var hasPermissions = ((UnixFileMode.OtherRead | UnixFileMode.GroupWrite) & unixFileMode) == 0; #else var entitlements = FileAccessPermissions.GroupWrite | FileAccessPermissions.OtherWrite; - var hasPermissions = _unixOperations.CheckFileHasAnyOfPermissions(filePath, entitlements); + var hasPermissions = !_unixOperations.CheckFileHasAnyOfPermissions(filePath, entitlements); #endif if (hasPermissions) { diff --git a/ci/image/Dockerfile.dotnet-centos7-net6-build b/ci/image/Dockerfile.dotnet-centos7-net6-build index 9924387c8..9bc9de834 100644 --- a/ci/image/Dockerfile.dotnet-centos7-net6-build +++ b/ci/image/Dockerfile.dotnet-centos7-net6-build @@ -34,7 +34,7 @@ SHELL [ "/usr/bin/scl", "enable", "devtoolset-8"] # dotnet-sdk-6.0 RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm -RUN yum -y install --exclude 1:openssl-libs-1.0.2k-26.el7_9.x86_64 dotnet-sdk-8.0 +RUN yum -y install --exclude 1:openssl-libs-1.0.2k-26.el7_9.x86_64 dotnet-sdk-6.0 # workspace RUN mkdir -p /home/user && \