| 1 | package stressClient |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | "time" |
| 6 | |
| 7 | influx "github.com/influxdata/influxdb/client/v2" |
| 8 | ) |
| 9 | |
| 10 | func NewBlankTestPoint() *influx.Point { |
| 11 | meas := "measurement" |
| 12 | tags := map[string]string{"fooTag": "fooTagValue"} |
| 13 | fields := map[string]interface{}{"value": 5920} |
| 14 | utc, _ := time.LoadLocation("UTC") |
| 15 | timestamp := time.Date(2016, time.Month(4), 20, 0, 0, 0, 0, utc) |
| 16 | pt, _ := influx.NewPoint(meas, tags, fields, timestamp) |
| 17 | return pt |
| 18 | } |
| 19 | |
| 20 | func TestStressTestBatcher(t *testing.T) { |
| 21 | sf, _, _ := NewTestStressTest() |
| 22 | bpconf := influx.BatchPointsConfig{ |
| 23 | Database: sf.TestDB, |
| 24 | Precision: "ns", |
| 25 | } |
| 26 | bp, _ := influx.NewBatchPoints(bpconf) |
| 27 | pt := NewBlankTestPoint() |
| 28 | bp = sf.batcher(pt, bp) |
| 29 | if len(bp.Points()) != 1 { |
| 30 | t.Fail() |
| 31 | } |
| 32 | } |