github.com/anycable/anycable-go@v1.5.1/metrics/config_test.go (about) 1 package metrics 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestLogEnabled(t *testing.T) { 10 config := NewConfig() 11 assert.False(t, config.LogEnabled()) 12 13 config.Log = true 14 assert.True(t, config.LogEnabled()) 15 16 config.Log = false 17 assert.False(t, config.LogEnabled()) 18 19 config = NewConfig() 20 config.LogFormatter = "test" 21 assert.True(t, config.LogEnabled()) 22 } 23 24 func TestHTTPEnabled(t *testing.T) { 25 config := NewConfig() 26 assert.False(t, config.HTTPEnabled()) 27 28 config.HTTP = "/metrics" 29 assert.True(t, config.HTTPEnabled()) 30 }