@@ -18,6 +18,7 @@ import (
18
18
"testing"
19
19
20
20
"github.com/stretchr/testify/assert"
21
+ "github.com/stretchr/testify/require"
21
22
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22
23
23
24
"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1"
@@ -44,8 +45,10 @@ func TestDefaultAnnotations(t *testing.T) {
44
45
}
45
46
46
47
// test
47
- annotations := Annotations (otelcol )
48
- podAnnotations := PodAnnotations (otelcol )
48
+ annotations , err := Annotations (otelcol )
49
+ require .NoError (t , err )
50
+ podAnnotations , err := PodAnnotations (otelcol )
51
+ require .NoError (t , err )
49
52
50
53
//verify
51
54
assert .Equal (t , "true" , annotations ["prometheus.io/scrape" ])
@@ -76,8 +79,10 @@ func TestNonDefaultPodAnnotation(t *testing.T) {
76
79
}
77
80
78
81
// test
79
- annotations := Annotations (otelcol )
80
- podAnnotations := PodAnnotations (otelcol )
82
+ annotations , err := Annotations (otelcol )
83
+ require .NoError (t , err )
84
+ podAnnotations , err := PodAnnotations (otelcol )
85
+ require .NoError (t , err )
81
86
82
87
//verify
83
88
assert .NotContains (t , annotations , "prometheus.io/scrape" , "Prometheus scrape annotation should not exist" )
@@ -116,8 +121,10 @@ func TestUserAnnotations(t *testing.T) {
116
121
}
117
122
118
123
// test
119
- annotations := Annotations (otelcol )
120
- podAnnotations := PodAnnotations (otelcol )
124
+ annotations , err := Annotations (otelcol )
125
+ require .NoError (t , err )
126
+ podAnnotations , err := PodAnnotations (otelcol )
127
+ require .NoError (t , err )
121
128
122
129
//verify
123
130
assert .Equal (t , "false" , annotations ["prometheus.io/scrape" ])
@@ -141,8 +148,10 @@ func TestAnnotationsPropagateDown(t *testing.T) {
141
148
}
142
149
143
150
// test
144
- annotations := Annotations (otelcol )
145
- podAnnotations := PodAnnotations (otelcol )
151
+ annotations , err := Annotations (otelcol )
152
+ require .NoError (t , err )
153
+ podAnnotations , err := PodAnnotations (otelcol )
154
+ require .NoError (t , err )
146
155
147
156
// verify
148
157
assert .Len (t , annotations , 5 )
0 commit comments