From 469b16d815ec1804229a58a2fd348cf959045085 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 9 Nov 2023 08:53:29 -0500 Subject: [PATCH] Fix test errors caused by DB truncation --- tests/Tgstation.Server.Tests/Live/Instance/JobsHubTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Tgstation.Server.Tests/Live/Instance/JobsHubTests.cs b/tests/Tgstation.Server.Tests/Live/Instance/JobsHubTests.cs index a52e6e1b1d..d097aae7eb 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/JobsHubTests.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/JobsHubTests.cs @@ -169,12 +169,17 @@ namespace Tgstation.Server.Tests.Live.Instance Assert.AreEqual(job.Cancelled, hubJob.Cancelled); } + static DateTimeOffset PerformDBTruncation(DateTimeOffset original) + => new DateTimeOffset( + original.Ticks - (original.Ticks % TimeSpan.TicksPerSecond), + original.Offset); + Assert.AreEqual(job.InstanceId, hubJob.InstanceId); Assert.AreEqual(job.StartedBy?.Id, hubJob.StartedBy?.Id); Assert.AreEqual(job.CancelRight, hubJob.CancelRight); Assert.AreEqual(job.CancelRightsType, hubJob.CancelRightsType); Assert.AreEqual(job.Description, hubJob.Description); - Assert.AreEqual(job.StartedAt, hubJob.StartedAt); + Assert.AreEqual(PerformDBTruncation(job.StartedAt.Value), PerformDBTruncation(hubJob.StartedAt.Value)); // RHS may NOT be DB truncated, both sides because not all DBs do this Assert.AreEqual(job.JobCode, hubJob.JobCode); } else