Skip to content

Commit

Permalink
Add derivative cardinality test
Browse files Browse the repository at this point in the history
  • Loading branch information
desa committed Mar 2, 2017
1 parent 005f88b commit a61965e
Show file tree
Hide file tree
Showing 2 changed files with 310 additions and 0 deletions.
272 changes: 272 additions & 0 deletions integrations/data/TestStream_Cardinality.srpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000001
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000002
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000003
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000004
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000005
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000006
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000007
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000008
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000009
dbname
rpname
cpu,cpu=cpu0,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu1,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu2,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu3,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu4,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu5,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu6,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu7,host=localhost usage_user=20.1 0000000010
dbname
rpname
cpu,cpu=cpu-total,host=localhost usage_user=20.1 0000000010
dbname
rpname
38 changes: 38 additions & 0 deletions integrations/streamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,44 @@ stream
testStreamerWithOutput(t, "TestStream_DerivativeNN", script, 15*time.Second, er, false, nil)
}

func TestStream_DerivativeCardinality(t *testing.T) {

var script = `
stream
|from()
.measurement('cpu')
.groupBy('host','cpu')
|derivative('usage_user')
`

// Expected Stats
es := map[string]map[string]interface{}{
"stream0": map[string]interface{}{
"avg_exec_time_ns": int64(0),
"errors": int64(0),
"working_cardinality": int64(0),
"collected": int64(9),
"emitted": int64(9),
},
"from1": map[string]interface{}{
"avg_exec_time_ns": int64(0),
"errors": int64(0),
"working_cardinality": int64(0),
"collected": int64(9),
"emitted": int64(9),
},
"derivative2": map[string]interface{}{
"emitted": int64(0),
"working_cardinality": int64(9),
"avg_exec_time_ns": int64(0),
"errors": int64(0),
"collected": int64(9),
},
}

testStreamerCardinality(t, "TestStream_Cardinality", script, es)
}

func TestStream_HoltWinters(t *testing.T) {
var script = `
stream
Expand Down

0 comments on commit a61965e

Please sign in to comment.