Add prometheus round trip unit tests (#6720)
This commit is contained in:
@@ -121,6 +121,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(53106) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851331000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -138,6 +139,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(53106) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851331000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -152,6 +154,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(50410) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360904552000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -169,6 +172,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(50410) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360904552000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -183,6 +187,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -199,6 +204,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -215,6 +221,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -231,6 +238,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -248,6 +256,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
},
|
||||
wantErr: false,
|
||||
@@ -296,6 +305,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(1) * time.Nanosecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(1, 0).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -312,6 +322,7 @@ func TestLineProtocolConverter_Record(t *testing.T) {
|
||||
"duration_ns": (time.Duration(1) * time.Nanosecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(1, 0).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/testutil"
|
||||
)
|
||||
|
||||
@@ -40,6 +41,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(53106) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851331000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -57,6 +59,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(53106) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851331000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -71,6 +74,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(50410) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360904552000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -88,6 +92,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(50410) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360904552000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -102,6 +107,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -118,6 +124,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -134,6 +141,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -150,6 +158,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -167,6 +176,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(103680) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1498688360851318000).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
},
|
||||
wantErr: false,
|
||||
@@ -189,6 +199,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(1) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1433330263415871*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -205,6 +216,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(1) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1433330263415871*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -221,6 +233,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": (time.Duration(1) * time.Microsecond).Nanoseconds(),
|
||||
},
|
||||
Time: time.Unix(0, 1433330263415871*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -240,7 +253,9 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
},
|
||||
Fields: map[string]interface{}{
|
||||
"duration_ns": int64(3000000),
|
||||
}, Time: time.Unix(0, 1503031538791000*int64(time.Microsecond)).UTC(),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538791000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -257,6 +272,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(3000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538791000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -273,6 +289,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(3000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538791000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -290,6 +307,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(3000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538791000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -307,6 +325,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(3000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538791000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -324,6 +343,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(3000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538791000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -338,6 +358,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -354,6 +375,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -370,6 +392,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -387,6 +410,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -404,6 +428,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -421,6 +446,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -438,6 +464,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -455,6 +482,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(10000000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538786000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -469,6 +497,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(23393000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538778000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -485,6 +514,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(23393000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538778000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -501,6 +531,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(23393000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538778000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -518,6 +549,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(23393000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538778000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -535,6 +567,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(23393000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538778000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
{
|
||||
Measurement: "zipkin",
|
||||
@@ -552,6 +585,7 @@ func TestZipkinPlugin(t *testing.T) {
|
||||
"duration_ns": int64(23393000),
|
||||
},
|
||||
Time: time.Unix(0, 1503031538778000*int64(time.Microsecond)).UTC(),
|
||||
Type: telegraf.Untyped,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user