github.com/grafana/synthetic-monitoring-agent@v0.64.2/internal/prober/prober_test.go (about) 1 package prober 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/grafana/synthetic-monitoring-agent/internal/feature" 8 "github.com/grafana/synthetic-monitoring-agent/internal/model" 9 "github.com/grafana/synthetic-monitoring-agent/internal/testhelper" 10 sm "github.com/grafana/synthetic-monitoring-agent/pkg/pb/synthetic_monitoring" 11 "github.com/rs/zerolog" 12 "github.com/stretchr/testify/require" 13 ) 14 15 func TestProberFactoryCoverage(t *testing.T) { 16 // This test will assert that the prober factory is handling all the 17 // known check types (as defined in the synthetic_monitoring package). 18 var store testhelper.NoopSecretStore 19 20 pf := NewProberFactory(nil, 0, feature.Collection{}, &store) 21 ctx := context.Background() 22 testLogger := zerolog.New(zerolog.NewTestWriter(t)) 23 24 for _, checkType := range sm.CheckTypeValues() { 25 var check model.Check 26 require.NoError(t, check.FromSM(sm.GetCheckInstance(checkType))) 27 28 _, _, err := pf.New(ctx, testLogger, check) 29 require.NotErrorIs(t, err, errUnsupportedCheckType) 30 } 31 }