Skip to content

Commit

Permalink
fix: adds a rev number to cache creation to prevent deserialization e…
Browse files Browse the repository at this point in the history
…rrors
  • Loading branch information
rvazarkar committed Nov 29, 2023
1 parent fd82e42 commit dbb16e9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/CommonLib/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Cache
//
// [DataMember]private ConcurrentDictionary<string, string> _valueToIDCache;

private static Version defaultVersion = new(1, 0, 0);
private static Version defaultVersion = new(1, 0, 0, 0);

private Cache()
{
Expand Down
2 changes: 1 addition & 1 deletion test/unit/CacheTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public CacheTest(ITestOutputHelper testOutputHelper)
public void Cache_TestNewCache()
{
var cache = Cache.CreateNewCache();
Assert.Equal(cache.CacheCreationVersion, new Version(1,0,0));
Assert.Equal(cache.CacheCreationVersion, new Version(1,0,0, 0));
var version = new Version(1, 0, 1);
cache = Cache.CreateNewCache(version);
var time = DateTime.Now.Date;
Expand Down
16 changes: 0 additions & 16 deletions test/unit/CommonLibHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,6 @@ public void ConvertFileTimeToUnixEpoch_Null_NegativeOne()
Assert.Equal(-1, result);
}

[Fact]
public void ConvertFileTimeToUnixEpoch_WrongFormat_FortmatException()
{
Exception ex =
Assert.Throws<FormatException>(() => SharpHoundCommonLib.Helpers.ConvertFileTimeToUnixEpoch("asdsf"));
Assert.Equal("Input string was not in a correct format.", ex.Message);
}

[Fact]
public void ConvertFileTimeToUnixEpoch_BadInput_CastExceptionReturnsNegativeOne()
{
Expand All @@ -219,13 +211,5 @@ public void ConvertTimestampToUnixEpoch_ValidTimestamp_ValidUnixEpoch()

Assert.Equal(d.ToUniversalTime().Date, testDate);
}

[Fact]
public void ConvertTimestampToUnixEpoch_InvalidTimestamp_FormatException()
{
Exception ex = Assert.Throws<FormatException>(() =>
SharpHoundCommonLib.Helpers.ConvertFileTimeToUnixEpoch("-201adsfasf12180244"));
Assert.Equal("Input string was not in a correct format.", ex.Message);
}
}
}

0 comments on commit dbb16e9

Please sign in to comment.