@@ -110,7 +110,10 @@ func TestContainerIDWithEntityID(t *testing.T) {
110
110
resetContainerID ()
111
111
112
112
entityIDEnvName := "DD_ENTITY_ID"
113
- defer func () { os .Unsetenv (entityIDEnvName ) }()
113
+ defer func () {
114
+ os .Unsetenv (entityIDEnvName )
115
+ resetContainerID ()
116
+ }()
114
117
os .Setenv (entityIDEnvName , "pod-uid" )
115
118
116
119
expectedTags := []string {"dd.internal.entity_id:pod-uid" }
@@ -123,14 +126,18 @@ func TestContainerIDWithEntityID(t *testing.T) {
123
126
124
127
sort .Strings (client .tags )
125
128
assert .Equal (t , expectedTags , client .tags )
126
- ts .assertContainerID (t , "" )
129
+ ts .assertContainerID (t , "fake-container-id " )
127
130
ts .sendAllAndAssert (t , client )
128
131
}
129
132
130
133
func TestContainerIDWithoutEntityID (t * testing.T ) {
131
134
resetContainerID ()
132
135
os .Unsetenv ("DD_ENTITY_ID" )
133
136
137
+ defer func () {
138
+ resetContainerID ()
139
+ }()
140
+
134
141
ts , client := newClientAndTestServer (t ,
135
142
"udp" ,
136
143
"localhost:8765" ,
@@ -164,7 +171,10 @@ func TestOriginDetectionEnabledWithEntityID(t *testing.T) {
164
171
resetContainerID ()
165
172
166
173
entityIDEnvName := "DD_ENTITY_ID"
167
- defer func () { os .Unsetenv (entityIDEnvName ) }()
174
+ defer func () {
175
+ os .Unsetenv (entityIDEnvName )
176
+ resetContainerID ()
177
+ }()
168
178
os .Setenv (entityIDEnvName , "pod-uid" )
169
179
170
180
originDetectionEnvName := "DD_ORIGIN_DETECTION_ENABLED"
@@ -181,7 +191,7 @@ func TestOriginDetectionEnabledWithEntityID(t *testing.T) {
181
191
182
192
sort .Strings (client .tags )
183
193
assert .Equal (t , expectedTags , client .tags )
184
- ts .assertContainerID (t , "" )
194
+ ts .assertContainerID (t , "fake-container-id " )
185
195
ts .sendAllAndAssert (t , client )
186
196
}
187
197
0 commit comments