Skip to content

Commit 862bd63

Browse files
committed
tests: Fixes Windows kubelet-stats test
The test spawns 10 pods with the same pod name, which contains multiple containers with the same container name. Because of this, the test fails. This commit addresses this issue.
1 parent 1efe51b commit 862bd63

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/e2e/windows/kubelet_stats.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package windows
1818

1919
import (
2020
"context"
21+
"fmt"
2122
"time"
2223

2324
v1 "k8s.io/api/core/v1"
@@ -128,7 +129,7 @@ func newKubeletStatsTestPods(numPods int, image imageutils.Config, nodeName stri
128129
podName := "statscollectiontest-" + string(uuid.NewUUID())
129130
pod := v1.Pod{
130131
ObjectMeta: metav1.ObjectMeta{
131-
Name: podName,
132+
Name: fmt.Sprintf("%s-%d", podName, i),
132133
Labels: map[string]string{
133134
"name": podName,
134135
"testapp": "stats-collection",
@@ -138,7 +139,7 @@ func newKubeletStatsTestPods(numPods int, image imageutils.Config, nodeName stri
138139
Containers: []v1.Container{
139140
{
140141
Image: image.GetE2EImage(),
141-
Name: podName,
142+
Name: "stat-container",
142143
Command: []string{
143144
"powershell.exe",
144145
"-Command",
@@ -149,7 +150,7 @@ func newKubeletStatsTestPods(numPods int, image imageutils.Config, nodeName stri
149150
InitContainers: []v1.Container{
150151
{
151152
Image: image.GetE2EImage(),
152-
Name: podName,
153+
Name: "init-container",
153154
Command: []string{
154155
"powershell.exe",
155156
"-Command",

0 commit comments

Comments
 (0)