change/fix expected test result

This commit is contained in:
Roman Plessl 2015-09-10 20:35:12 +02:00 committed by Cameron Sparr
parent 2ee7d5eeb6
commit cb887dee81
1 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,53 @@
package opentsdb
import (
"reflect"
"testing"
)
var (
fakeHost = "metrics.example.com"
fakePort = 4242
)
func fakeOpenTSDB() *OpenTSDB {
var o OpenTSDB
o.Host = fakeHost
o.Port = fakePort
return &o
}
func TestBuildTagsTelnet(t *testing.T) {
var tagtests = []struct {
bpIn map[string]string
ptIn map[string]string
outTags []string
}{
{
map[string]string{"one": "two"},
map[string]string{"three": "four"},
[]string{"one=two", "three=four"},
},
{
map[string]string{"aaa": "bbb"},
map[string]string{},
[]string{"aaa=bbb"},
},
{
map[string]string{"one": "two"},
map[string]string{"aaa": "bbb"},
[]string{"aaa=bbb", "one=two"},
},
{
map[string]string{},
map[string]string{},
[]string{},
},
}
for _, tt := range tagtests {
tags := buildTags(tt.bpIn, tt.ptIn)
if !reflect.DeepEqual(tags, tt.outTags) {
t.Errorf("\nexpected %+v\ngot %+v\n", tt.outTags, tags)
}
}
}