diff options
author | Wolfy-J <[email protected]> | 2019-06-27 14:20:48 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-06-27 14:20:48 +0300 |
commit | a351210ac22fa6bcbf37e53dde0814245b927524 (patch) | |
tree | 94d0d0c9ef6fad6d824093ad59e60114125320a8 /service | |
parent | 2164c21ca0e2320395045d0eb48023b6eb1bb5fe (diff) |
more tests
Diffstat (limited to 'service')
-rw-r--r-- | service/metrics/rpc_test.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/service/metrics/rpc_test.go b/service/metrics/rpc_test.go index c75e72fb..e9846e4b 100644 --- a/service/metrics/rpc_test.go +++ b/service/metrics/rpc_test.go @@ -142,6 +142,23 @@ func Test_Set_RPC_MetricError_2(t *testing.T) { }, &ok)) } +func Test_Set_RPC_MetricError_3(t *testing.T) { + client, c := setup( + t, + `"user_gauge":{ + "type": "histogram", + "labels": ["type", "section"] + }`, + ) + defer c.Stop() + + var ok bool + assert.Error(t, client.Call("metrics.Set", Metric{ + Name: "user_gauge", + Value: 100.0, + }, &ok)) +} + // -- observe func Test_Observe_RPC(t *testing.T) { @@ -264,6 +281,40 @@ func Test_Observe2_RPC(t *testing.T) { assert.Contains(t, out, `user_histogram`) } +func Test_Observe2_RPC_Invalid(t *testing.T) { + client, c := setup( + t, + `"user_histogram":{ + "type": "summary" + }`, + ) + defer c.Stop() + + var ok bool + assert.Error(t, client.Call("metrics.Observe", Metric{ + Name: "user_histogram_2", + Value: 100.0, + Labels: []string{"missing"}, + }, &ok)) +} + +func Test_Observe2_RPC_Invalid_2(t *testing.T) { + client, c := setup( + t, + `"user_histogram":{ + "type": "gauge" + }`, + ) + defer c.Stop() + + var ok bool + assert.Error(t, client.Call("metrics.Observe", Metric{ + Name: "user_histogram_2", + Value: 100.0, + Labels: []string{"missing"}, + }, &ok)) +} + func Test_Observe2_RPC_Vector(t *testing.T) { client, c := setup( t, |