Skip to content

Commit

Permalink
SNOW-990111: Update EasyLoggingStarterTest
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Jan 25, 2024
1 parent 5635772 commit 31fefeb
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions Snowflake.Data.Tests/UnitTests/Session/EasyLoggingStarterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,15 @@ public void TestThatConfiguresEasyLoggingOnlyOnceWhenInitializedWithConfigPath()
t_easyLoggerStarter.Init(ConfigPath);

// assert
t_directoryOperations.Verify(d => d.CreateDirectory(s_expectedLogPath), Times.Once);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
t_directoryOperations.Verify(d => d.CreateDirectory(s_expectedLogPath), Times.Once);
}
else
{
t_unixOperations.Verify(u => u.CreateDirectoryWithPermissions(s_expectedLogPath,
FilePermissions.S_IRUSR | FilePermissions.S_IWUSR | FilePermissions.S_IXUSR), Times.Once);
}
t_easyLoggerManager.Verify(manager => manager.ReconfigureEasyLogging(EasyLoggingLogLevel.Error, s_expectedLogPath), Times.Once);

// act
Expand All @@ -195,7 +203,15 @@ public void TestThatConfiguresEasyLoggingOnlyOnceForInitializationsWithoutConfig
t_easyLoggerStarter.Init(null);

// assert
t_directoryOperations.Verify(d => d.CreateDirectory(s_expectedLogPath), Times.Once);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
t_directoryOperations.Verify(d => d.CreateDirectory(s_expectedLogPath), Times.Once);
}
else
{
t_unixOperations.Verify(u => u.CreateDirectoryWithPermissions(s_expectedLogPath,
FilePermissions.S_IRUSR | FilePermissions.S_IWUSR | FilePermissions.S_IXUSR), Times.Once);
}
t_easyLoggerManager.Verify(manager => manager.ReconfigureEasyLogging(EasyLoggingLogLevel.Error, s_expectedLogPath), Times.Once);
}

Expand All @@ -214,7 +230,15 @@ public void TestThatReconfiguresEasyLoggingWithConfigPathIfNotGivenForTheFirstTi
t_easyLoggerStarter.Init(null);

// assert
t_directoryOperations.Verify(d => d.CreateDirectory(s_expectedLogPath), Times.Once);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
t_directoryOperations.Verify(d => d.CreateDirectory(s_expectedLogPath), Times.Once);
}
else
{
t_unixOperations.Verify(u => u.CreateDirectoryWithPermissions(s_expectedLogPath,
FilePermissions.S_IRUSR | FilePermissions.S_IWUSR | FilePermissions.S_IXUSR), Times.Once);
}
t_easyLoggerManager.Verify(manager => manager.ReconfigureEasyLogging(EasyLoggingLogLevel.Error, s_expectedLogPath), Times.Once);

// act
Expand Down

0 comments on commit 31fefeb

Please sign in to comment.