Skip to content

Commit

Permalink
getHostname test
Browse files Browse the repository at this point in the history
  • Loading branch information
pglombardo committed Apr 17, 2017
1 parent e62b695 commit f2f64f5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions recorder_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,20 @@ func TestGetStringTag(t *testing.T) {
tag = getStringTag(rawSpan, "float")
assert.EqualValues(t, "2.3420493", tag, "geStringTag should return string for non-string tag values")
}

func TestGetHostName(t *testing.T) {
opts := Options{LogLevel: Debug}

InitSensor(&opts)
recorder := NewTestRecorder()
tracer := NewTracerWithEverything(&opts, recorder)

sp := tracer.StartSpan("http-client")
sp.SetTag("int", 1)
sp.SetTag("float", 2.3420493)
sp.SetTag("two", "twotwo")
sp.Finish()
rawSpan := sp.(*spanS).raw
hostname := getHostName(rawSpan)
assert.True(t, len(hostname) > 0, "must return a valid string value")
}

0 comments on commit f2f64f5

Please sign in to comment.