Ensure sending of the Sentry End debug message.
This commit is contained in:

committed by
Sebastian Serth

parent
4fb6ab980b
commit
f309d0f70e
@ -20,3 +20,25 @@ func TestSentryDebugWriter_Write(t *testing.T) {
|
||||
assert.Equal(t, len(data), count)
|
||||
assert.NotContains(t, buf.String(), description)
|
||||
}
|
||||
|
||||
func TestSentryDebugWriter_Close(t *testing.T) {
|
||||
buf := &bytes.Buffer{}
|
||||
s := NewSentryDebugWriter(buf, context.Background())
|
||||
require.Empty(t, s.lastSpan.Tags)
|
||||
|
||||
s.Close(42)
|
||||
require.Contains(t, s.lastSpan.Tags, "exit_code")
|
||||
assert.Equal(t, "42", s.lastSpan.Tags["exit_code"])
|
||||
}
|
||||
|
||||
func TestSentryDebugWriter_handleTimeDebugMessage(t *testing.T) {
|
||||
buf := &bytes.Buffer{}
|
||||
s := NewSentryDebugWriter(buf, context.Background())
|
||||
require.Equal(t, "nomad.execute.connect", s.lastSpan.Op)
|
||||
|
||||
description := "TestDebugMessageDescription"
|
||||
match := map[string][]byte{"time": []byte("1676646791482"), "text": []byte(description)}
|
||||
s.handleTimeDebugMessage(match)
|
||||
assert.Equal(t, "nomad.execute.bash", s.lastSpan.Op)
|
||||
assert.Equal(t, description, s.lastSpan.Description)
|
||||
}
|
||||
|
Reference in New Issue
Block a user