-
Notifications
You must be signed in to change notification settings - Fork 0
/
myinfluxdb_test.go
54 lines (41 loc) · 1.26 KB
/
myinfluxdb_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package myinfluxdb
import (
"reflect"
"testing"
)
var influxDBTestHTTP = InfluxConfig{Hostname: "localhost", Protocol: "http", Port: "8092",
Db: "test",
Username: "username",
Password: "password",
Tags: map[string]string{"addkey1": "value1", "addkey2": "value2"}}
var influxDBTestUDP = InfluxConfig{Hostname: "localhost", Protocol: "udp", Port: "8092",
Db: "test",
Username: "username",
Password: "password",
Tags: map[string]string{"addkey1": "value1", "addkey2": "value2"}}
var InfluxMetricSample = InfluxMetric{
Tags: map[string]string{
"key1": "value1",
"key2": "value2",
},
Values: map[string]interface{}{
"key1": "value1",
"key2": "value2",
}, Measurement: "key1"}
var TT []InfluxMetric
func TestSend(t *testing.T) {
TT = append(TT, InfluxMetricSample)
TT = append(TT, InfluxMetricSample)
t.Log("Testing: Send()")
//influxDBTestHTTP.Send(&TT)
// influxDBTestUDP.Send(&TT)
}
func TestAddTags(t *testing.T) {
result := map[string]string{"addkey1": "value1", "addkey2": "value2", "key1": "value1", "key2": "value2"}
t.Log("Testing: AddTags()")
metric := InfluxMetricSample
metric.AddTags(influxDBTestHTTP.Tags)
if !reflect.DeepEqual(metric.Tags, result) {
t.Errorf("Added tags are different from what we expect")
}
}