From 0f584206c3db0352037525e3bada8a2852ebe119 Mon Sep 17 00:00:00 2001 From: Damon Barry Date: Thu, 16 Jan 2025 17:04:54 -0800 Subject: [PATCH] Fix hard-coded timestamp in unit tests (#7413) 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: --- .../TokenHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edge-util/test/Microsoft.Azure.Devices.Edge.Util.Test.Common/TokenHelper.cs b/edge-util/test/Microsoft.Azure.Devices.Edge.Util.Test.Common/TokenHelper.cs index a058ab10dc3..dbcbac828e6 100644 --- a/edge-util/test/Microsoft.Azure.Devices.Edge.Util.Test.Common/TokenHelper.cs +++ b/edge-util/test/Microsoft.Azure.Devices.Edge.Util.Test.Common/TokenHelper.cs @@ -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) {