Skip to content

Commit

Permalink
Fix hard-coded timestamp in unit tests (#7413)
Browse files Browse the repository at this point in the history
Several unit tests started failing after the new year due to a hard-coded timestamp that was supposed to represent a valid future time, but is now in the past. This change updates the test code to generate a timestamp that is one year in the future relative to DateTime.Now. I confirmed the unit tests pass once more.

## Azure IoT Edge PR checklist:
  • Loading branch information
damonbarry authored Jan 17, 2025
1 parent 569235e commit 0f58420
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.Azure.Devices.Edge.Util.Test.Common
public static class TokenHelper
{
public static string CreateSasToken(string resourceUri, string key = null, bool expired = false) =>
CreateSasToken(resourceUri, expired ? new DateTime(2010, 1, 1) : new DateTime(2025, 1, 1), key);
CreateSasToken(resourceUri, expired ? new DateTime(2010, 1, 1) : DateTime.Now.AddYears(1), key);

public static string CreateSasToken(string resourceUri, DateTime expiryTime, string key = null)
{
Expand Down

0 comments on commit 0f58420

Please sign in to comment.