Skip to content

Commit

Permalink
SNOW-990111: Refactor easy logging changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Jan 23, 2024
1 parent e40116a commit 47d07bf
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Mono.Unix;
using Moq;
using NUnit.Framework;
using Snowflake.Data.Configuration;
Expand Down Expand Up @@ -96,11 +97,12 @@ public void TestThatCreatedDirectoryPermissionsFollowUmask()
.Setup(provider => provider.CreateDirectory(s_expectedLogPath))
.Returns(Directory.CreateDirectory(s_expectedLogPath));

var expectedDirPermissions = AllPermissions - int.Parse(CallBash("umask"));

// act
t_easyLoggerStarter.Init(ConfigPath);
var expectedDirPermissions = AllPermissions - int.Parse(CallBash("umask"));
string commandParameters = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "-c '%a'" : "-f %A";
var dirPermissions = int.Parse(CallBash($"stat {commandParameters} {s_expectedLogPath}"));
var dirInfo = new UnixDirectoryInfo(s_expectedLogPath);
var dirPermissions = EasyLoggerUtil.ConvertFileAccessPermissionsToInt(dirInfo.FileAccessPermissions);

// assert
Assert.AreEqual(expectedDirPermissions, dirPermissions);
Expand Down

0 comments on commit 47d07bf

Please sign in to comment.