github.com/lyft/flytestdlib@v0.3.12-0.20210213045714-8cdd111ecda1/promutils/workqueue_test.go (about)

     1  package promutils
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/prometheus/client_golang/prometheus"
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  var provider = prometheusMetricsProvider{}
    11  
    12  func TestPrometheusMetricsProvider(t *testing.T) {
    13  	t.Run("Adds", func(t *testing.T) {
    14  		c := provider.NewAddsMetric("x")
    15  		_, ok := c.(prometheus.Counter)
    16  		assert.True(t, ok)
    17  	})
    18  
    19  	t.Run("Depth", func(t *testing.T) {
    20  		c := provider.NewDepthMetric("x")
    21  		_, ok := c.(prometheus.Gauge)
    22  		assert.True(t, ok)
    23  	})
    24  
    25  	t.Run("Latency", func(t *testing.T) {
    26  		c := provider.NewLatencyMetric("x")
    27  		_, ok := c.(prometheus.Summary)
    28  		assert.True(t, ok)
    29  	})
    30  
    31  	t.Run("Retries", func(t *testing.T) {
    32  		c := provider.NewRetriesMetric("x")
    33  		_, ok := c.(prometheus.Counter)
    34  		assert.True(t, ok)
    35  	})
    36  
    37  	t.Run("WorkDuration", func(t *testing.T) {
    38  		c := provider.NewWorkDurationMetric("x")
    39  		_, ok := c.(prometheus.Summary)
    40  		assert.True(t, ok)
    41  	})
    42  }