Skip to content

Commit 9ca33bc

Browse files
committed
Changed featuregate into CLI - instrumentation go
Signed-off-by: Yuri Sa <[email protected]>
1 parent 1d0115e commit 9ca33bc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/instrumentation/upgrade/upgrade_test.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/go-logr/logr"
2323
"github.com/stretchr/testify/assert"
2424
"github.com/stretchr/testify/require"
25+
colfeaturegate "go.opentelemetry.io/collector/featuregate"
2526
corev1 "k8s.io/api/core/v1"
2627
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2728
"k8s.io/apimachinery/pkg/types"
@@ -31,9 +32,16 @@ import (
3132
"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
3233
"github.com/open-telemetry/opentelemetry-operator/internal/config"
3334
"github.com/open-telemetry/opentelemetry-operator/pkg/constants"
35+
"github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
3436
)
3537

3638
func TestUpgrade(t *testing.T) {
39+
originalVal := featuregate.EnableNginxAutoInstrumentationSupport.IsEnabled()
40+
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNginxAutoInstrumentationSupport.ID(), true))
41+
t.Cleanup(func() {
42+
require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableNginxAutoInstrumentationSupport.ID(), originalVal))
43+
})
44+
3745
nsName := strings.ToLower(t.Name())
3846
err := k8sClient.Create(context.Background(), &corev1.Namespace{
3947
ObjectMeta: metav1.ObjectMeta{
@@ -117,4 +125,4 @@ func TestUpgrade(t *testing.T) {
117125
assert.Equal(t, "apache-httpd:2", updated.Spec.ApacheHttpd.Image)
118126
assert.Equal(t, "nginx:2", updated.Annotations[constants.AnnotationDefaultAutoInstrumentationNginx])
119127
assert.Equal(t, "nginx:2", updated.Spec.Nginx.Image)
120-
}
128+
}

0 commit comments

Comments
 (0)