From 3fc015e09aacb799cd87b7b248da1bf22e4db109 Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Tue, 13 Jan 2026 17:38:43 +0100 Subject: [PATCH] Fix timestamp comparison in federated tracing test Parse ISO 8601 timestamps using Carbon before comparing them. Protobuf serialization may produce timestamps with varying microsecond precision (e.g., `.619Z` vs `.619236Z`), which causes string comparisons to fail because `619236Z` is alphabetically less than `619Z`. Co-Authored-By: Claude --- .../Tracing/FederatedTracingExtensionTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/Integration/Tracing/FederatedTracingExtensionTest.php b/tests/Integration/Tracing/FederatedTracingExtensionTest.php index 15b6c76f6..51c399f48 100644 --- a/tests/Integration/Tracing/FederatedTracingExtensionTest.php +++ b/tests/Integration/Tracing/FederatedTracingExtensionTest.php @@ -4,6 +4,7 @@ use GraphQL\Error\DebugFlag; use Illuminate\Contracts\Config\Repository; +use Illuminate\Support\Carbon; use Nuwave\Lighthouse\Federation\FederationServiceProvider; use Nuwave\Lighthouse\Tracing\FederatedTracing\FederatedTracing; use Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace; @@ -129,11 +130,11 @@ public function testAddFtv1ExtensionMetaToBatchedResults(): void $trace1Data = $this->decodeFtv1Record($result->json('0.extensions.ftv1')); $trace2Data = $this->decodeFtv1Record($result->json('1.extensions.ftv1')); - $startTime1 = $trace1Data['startTime']; - $endTime1 = $trace1Data['endTime']; + $startTime1 = Carbon::parse($trace1Data['startTime']); + $endTime1 = Carbon::parse($trace1Data['endTime']); - $startTime2 = $trace2Data['startTime']; - $endTime2 = $trace2Data['endTime']; + $startTime2 = Carbon::parse($trace2Data['startTime']); + $endTime2 = Carbon::parse($trace2Data['endTime']); // Guaranteed by the usleep() in $this->resolve() $this->assertGreaterThan($startTime1, $endTime1);