Skip to content

Commit

Permalink
enhance logging
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Sep 25, 2024
1 parent 5dd7a82 commit 8d8d10c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions internal/testbed/integration/combinedload/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestLoad_Combined(t *testing.T) {
OtlpEndpoint: fmt.Sprintf("otelcol-%s.%s:4317", testID, testNs),
DataTypes: []string{"traces"},
}
t.Log("deploying telemetrygen...")

telemetryGenObjs, telemetryGenObjInfos := k8stest.CreateTelemetryGenObjects(t, k8sClient, createTeleOpts)
defer func() {
for _, obj := range append(collectorObjs, telemetryGenObjs...) {
Expand All @@ -78,7 +78,6 @@ func TestLoad_Combined(t *testing.T) {
for _, info := range telemetryGenObjInfos {
k8stest.WaitForTelemetryGenToStart(t, k8sClient, info.Namespace, info.PodLabelSelectors, info.Workload, info.DataType)
}
t.Log("telemetrygen deployed")

otelColPodName, err := k8stest.GetPodNameByLabels(k8sClient.DynamicClient, testNs, map[string]string{
"app.kubernetes.io/name": "opentelemetry-collector",
Expand Down
3 changes: 2 additions & 1 deletion internal/testcommon/k8stest/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func CreateCollectorObjects(t *testing.T, client *K8sClient, testID string, mani
var podNamespace string
var podLabels map[string]any
createdObjs := make([]*unstructured.Unstructured, 0, len(manifestFiles))
t.Log("Creating Collector objects...")
for _, manifestFile := range manifestFiles {
tmpl := template.Must(template.New(manifestFile.Name()).ParseFiles(filepath.Join(manifestsDir, manifestFile.Name())))
manifest := &bytes.Buffer{}
Expand Down Expand Up @@ -97,7 +98,7 @@ func WaitForCollectorToStart(t *testing.T, client *K8sClient, podNamespace strin
}
}
if podsNotReady == 0 {
t.Logf("collector pods are ready")
t.Log("Collector deployed successfully")
return true
}
return false
Expand Down
3 changes: 3 additions & 0 deletions internal/testcommon/k8stest/telemetrygen.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func CreateTelemetryGenObjects(t *testing.T, client *K8sClient, createOpts *Tele
"OTLPEndpoint": createOpts.OtlpEndpoint,
"TestID": createOpts.TestID,
}))
t.Logf("Creating telemetrygen object from manifest %s", manifestFile.Name())
obj, err := CreateObject(client, manifest.Bytes())
require.NoErrorf(t, err, "failed to create telemetrygen object from manifest %s", manifestFile.Name())
selector := obj.Object["spec"].(map[string]any)["selector"]
Expand Down Expand Up @@ -77,4 +78,6 @@ func WaitForTelemetryGenToStart(t *testing.T, client *K8sClient, podNamespace st
return podPhase == "Running"
}, time.Duration(podTimeoutMinutes)*time.Minute, 50*time.Millisecond,
"telemetrygen pod of Workload [%s] in datatype [%s] haven't started within %d minutes, latest pod phase is %s", workload, dataType, podTimeoutMinutes, podPhase)

t.Logf("Telemetrygen pod for datatype [%s] started successfully", dataType)
}

0 comments on commit 8d8d10c

Please sign in to comment.