55package otel
66
77import (
8- "context"
98 "os"
109 "path/filepath"
1110 "runtime"
1211 "testing"
13- "time"
1412
1513 "github.com/stretchr/testify/assert"
16- "go.opentelemetry.io/collector/featuregate"
1714 "go.opentelemetry.io/collector/otelcol"
1815 "go.uber.org/zap"
1916 "go.uber.org/zap/zapcore"
@@ -31,12 +28,6 @@ func TestSamples(t *testing.T) {
3128 t .Setenv ("AUTOOPS_TEMP_RESOURCE_ID" , "temp" )
3229 t .Setenv ("AUTOOPS_OTEL_URL" , "http://localhost:4318" )
3330
34- // Enable service.profilesSupport featuregate to test the profiling samples.
35- assert .NoError (t , featuregate .GlobalRegistry ().Set ("service.profilesSupport" , true ))
36- defer func () {
37- assert .NoError (t , featuregate .GlobalRegistry ().Set ("service.profilesSupport" , false ))
38- }()
39-
4031 err := filepath .WalkDir (filepath .Join ("." , "samples" , runtime .GOOS ), func (path string , d os.DirEntry , err error ) error {
4132 if err != nil {
4233 return err
@@ -60,13 +51,6 @@ func testSample(t *testing.T, configFile string) {
6051 collector , err := otelcol .NewCollector (* settings )
6152 assert .NoError (t , err )
6253 assert .NotNil (t , collector )
63-
64- wg := startCollector (context .Background (), t , collector , "" )
65-
66- assert .Eventually (t , func () bool {
67- return otelcol .StateRunning == collector .GetState ()
68- }, 20 * time .Second , 200 * time .Millisecond )
54+ assert .NoError (t , collector .DryRun (t .Context ()))
6955 collector .Shutdown ()
70- wg .Wait ()
71- assert .Equal (t , otelcol .StateClosed , collector .GetState ())
7256}
0 commit comments