fix shared_test, add hostName field
This commit is contained in:
parent
734553dc2a
commit
116a31fbef
1 changed files with 10 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
package shared
|
package shared
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -8,13 +9,21 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBlobTrace_Serialize(t *testing.T) {
|
func TestBlobTrace_Serialize(t *testing.T) {
|
||||||
|
hostName, err := os.Hostname()
|
||||||
|
assert.NoError(t, err)
|
||||||
stack := NewBlobTrace(10*time.Second, "test")
|
stack := NewBlobTrace(10*time.Second, "test")
|
||||||
stack.Stack(20*time.Second, "test2")
|
stack.Stack(20*time.Second, "test2")
|
||||||
stack.Stack(30*time.Second, "test3")
|
stack.Stack(30*time.Second, "test3")
|
||||||
serialized, err := stack.Serialize()
|
serialized, err := stack.Serialize()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
t.Log(serialized)
|
t.Log(serialized)
|
||||||
expected := "{\"stacks\":[{\"timing\":10000000000,\"origin_name\":\"test\"},{\"timing\":20000000000,\"origin_name\":\"test2\"},{\"timing\":30000000000,\"origin_name\":\"test3\"}]}"
|
expected := "{\"stacks\":[{\"timing\":10000000000,\"origin_name\":\"test\",\"host_name\":\"" +
|
||||||
|
hostName +
|
||||||
|
"\"},{\"timing\":20000000000,\"origin_name\":\"test2\",\"host_name\":\"" +
|
||||||
|
hostName +
|
||||||
|
"\"},{\"timing\":30000000000,\"origin_name\":\"test3\",\"host_name\":\"" +
|
||||||
|
hostName +
|
||||||
|
"\"}]}"
|
||||||
assert.Equal(t, expected, serialized)
|
assert.Equal(t, expected, serialized)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue