Skip to content

Commit 3fc015e

Browse files
spawniaclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 82390ae commit 3fc015e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/Integration/Tracing/FederatedTracingExtensionTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use GraphQL\Error\DebugFlag;
66
use Illuminate\Contracts\Config\Repository;
7+
use Illuminate\Support\Carbon;
78
use Nuwave\Lighthouse\Federation\FederationServiceProvider;
89
use Nuwave\Lighthouse\Tracing\FederatedTracing\FederatedTracing;
910
use Nuwave\Lighthouse\Tracing\FederatedTracing\Proto\Trace;
@@ -129,11 +130,11 @@ public function testAddFtv1ExtensionMetaToBatchedResults(): void
129130
$trace1Data = $this->decodeFtv1Record($result->json('0.extensions.ftv1'));
130131
$trace2Data = $this->decodeFtv1Record($result->json('1.extensions.ftv1'));
131132

132-
$startTime1 = $trace1Data['startTime'];
133-
$endTime1 = $trace1Data['endTime'];
133+
$startTime1 = Carbon::parse($trace1Data['startTime']);
134+
$endTime1 = Carbon::parse($trace1Data['endTime']);
134135

135-
$startTime2 = $trace2Data['startTime'];
136-
$endTime2 = $trace2Data['endTime'];
136+
$startTime2 = Carbon::parse($trace2Data['startTime']);
137+
$endTime2 = Carbon::parse($trace2Data['endTime']);
137138

138139
// Guaranteed by the usleep() in $this->resolve()
139140
$this->assertGreaterThan($startTime1, $endTime1);

0 commit comments

Comments
 (0)