@@ -84,6 +84,9 @@ func TestOtelKubeStackHelm(t *testing.T) {
84
84
// - Two Gateway pods to collect, aggregate and forward
85
85
// telemetry.
86
86
k8sStepCheckRunningPods ("app.kubernetes.io/managed-by=opentelemetry-operator" , 4 , "otc-container" ),
87
+ // validate kubeletstats metrics are being
88
+ // pushed
89
+ k8sStepCheckDatastreamsHits (info , "metrics" , "kubeletstatsreceiver.otel" , "default" ),
87
90
},
88
91
},
89
92
{
@@ -287,18 +290,20 @@ func k8sStepCheckRunningPods(podLabelSelector string, expectedPodNumber int, con
287
290
func k8sStepCheckDatastreamsHits (info * define.Info , dsType , dataset , namespace string ) k8sTestStep {
288
291
datastream := fmt .Sprintf ("%s-%s-%s" , dsType , dataset , namespace )
289
292
return func (t * testing.T , ctx context.Context , kCtx k8sContext , namespace string ) {
290
- var initDocumentHits estools. Hits
291
- require . Eventually ( t , func () bool {
293
+ var initDocumentHits int
294
+ getTotalDocs := func (t * testing. T ) int {
292
295
docs , err := estools .GetLogsForDatastream (ctx , info .ESClient , dsType , dataset , namespace )
293
296
require .NoError (t , err , "failed to get %s datastream documents" , datastream )
294
- initDocumentHits = docs .Hits
295
- return docs .Hits .Total .Value > 0
297
+ return docs .Hits .Total .Value
298
+ }
299
+
300
+ require .Eventually (t , func () bool {
301
+ initDocumentHits = getTotalDocs (t )
302
+ return initDocumentHits > 0
296
303
}, 5 * time .Minute , 10 * time .Second , fmt .Sprintf ("at least one document should be available for %s datastream" , datastream ))
297
304
298
305
require .Eventually (t , func () bool {
299
- docs , err := estools .GetLogsForDatastream (ctx , info .ESClient , dsType , dataset , namespace )
300
- require .NoError (t , err , "failed to get %s datastream documents" , datastream )
301
- return docs .Hits .Total .Value > initDocumentHits .Total .Value
306
+ return getTotalDocs (t ) > initDocumentHits
302
307
}, 5 * time .Minute , 10 * time .Second , fmt .Sprintf ("no new documents for %s datastream" , datastream ))
303
308
}
304
309
}
0 commit comments