Skip to content

Commit

Permalink
Adding safe method to get SpanID on assertion (#2313)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbdias committed Apr 5, 2023
1 parent 125db30 commit 8c056d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/executor/assertion_runner.go
Expand Up @@ -191,7 +191,7 @@ func (e *defaultAssertionRunner) emitFailedAssertions(ctx context.Context, req A
req.Run.TestID,
req.Run.ID,
unwrappedError,
spanAssertionResult.SpanID.String(),
spanAssertionResult.SafeSpanIDString(),
string(assertionResult.Assertion),
))
}
Expand All @@ -201,7 +201,7 @@ func (e *defaultAssertionRunner) emitFailedAssertions(ctx context.Context, req A
req.Run.TestID,
req.Run.ID,
spanAssertionResult.CompareErr,
spanAssertionResult.SpanID.String(),
spanAssertionResult.SafeSpanIDString(),
string(assertionResult.Assertion),
))
}
Expand Down
8 changes: 8 additions & 0 deletions server/model/tests.go
Expand Up @@ -137,6 +137,14 @@ type (
}
)

func (sar SpanAssertionResult) SafeSpanIDString() string {
if sar.SpanID == nil {
return ""
}

return sar.SpanID.String()
}

func (t Test) HasID() bool {
return t.ID != ""
}
Expand Down

0 comments on commit 8c056d8

Please sign in to comment.