Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion AISKU/Tests/Unit/src/SpanLifeCycle.Tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,16 @@ export class SpanLifeCycleTests extends AITestClass {
test: () => {
// Arrange
const span = this._ai.startSpan("endtime-custom");
const customEndTime = Date.now();

// Derive the custom end time from the span's own start time so the
// round-trip comparison stays within the same time domain the SDK
// uses internally (perf timeOrigin based). Using Date.now() directly
// is unreliable on some CI hosts where the system wall clock can drift
// slightly behind the span start time, which causes end() to clamp the
// duration to zero (endTime === startTime) and fail the tolerance check.
const startTime = span?.startTime;
const startMs = startTime ? (startTime[0] * 1000 + startTime[1] / 1000000) : Date.now();
const customEndTime = startMs + 1000; // 1 second after the span start
Comment on lines +580 to +582

// Act
span?.end(customEndTime);
Expand Down
Loading