@@ -22,6 +22,7 @@ import (
22
22
"github.com/go-logr/logr"
23
23
"github.com/stretchr/testify/assert"
24
24
"github.com/stretchr/testify/require"
25
+ colfeaturegate "go.opentelemetry.io/collector/featuregate"
25
26
corev1 "k8s.io/api/core/v1"
26
27
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27
28
"k8s.io/apimachinery/pkg/types"
@@ -31,9 +32,16 @@ import (
31
32
"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
32
33
"github.com/open-telemetry/opentelemetry-operator/internal/config"
33
34
"github.com/open-telemetry/opentelemetry-operator/pkg/constants"
35
+ "github.com/open-telemetry/opentelemetry-operator/pkg/featuregate"
34
36
)
35
37
36
38
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
+
37
45
nsName := strings .ToLower (t .Name ())
38
46
err := k8sClient .Create (context .Background (), & corev1.Namespace {
39
47
ObjectMeta : metav1.ObjectMeta {
@@ -117,4 +125,4 @@ func TestUpgrade(t *testing.T) {
117
125
assert .Equal (t , "apache-httpd:2" , updated .Spec .ApacheHttpd .Image )
118
126
assert .Equal (t , "nginx:2" , updated .Annotations [constants .AnnotationDefaultAutoInstrumentationNginx ])
119
127
assert .Equal (t , "nginx:2" , updated .Spec .Nginx .Image )
120
- }
128
+ }
0 commit comments