Sitelet https://github.com/kubernetes/kops/commit/11cad45fe06b6dc17c7654cc3a35c6aa54ed28da
Skip to content

Commit 11cad45

Browse files
committed
kube-proxy: assert buildPod command in unit test
1 parent a1f94fc commit 11cad45

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

‎nodeup/pkg/model/kube_proxy_test.go‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ import (
2323
"k8s.io/kops/pkg/apis/kops"
2424
kopsmodel "k8s.io/kops/pkg/apis/kops/model"
2525
"k8s.io/kops/pkg/apis/nodeup"
26-
"k8s.io/kops/pkg/flagbuilder"
2726
"k8s.io/kops/upup/pkg/fi"
2827
"k8s.io/kops/util/pkg/architectures"
29-
"k8s.io/kops/util/pkg/exec"
3028

3129
v1 "k8s.io/api/core/v1"
3230
"k8s.io/apimachinery/pkg/api/resource"
@@ -48,14 +46,6 @@ func TestKubeProxyBuilder_buildPod(t *testing.T) {
4846
KubeProxy: &kubeProxy,
4947
}
5048

51-
flags, _ := flagbuilder.BuildFlagsList(&kubeProxy)
52-
53-
flags = append(flags, []string{
54-
"--kubeconfig=/var/lib/kube-proxy/kubeconfig",
55-
"--oom-score-adj=-998",
56-
`--resource-container=""`,
57-
}...)
58-
5949
type fields struct {
6050
NodeupModelContext *NodeupModelContext
6151
}
@@ -96,7 +86,7 @@ func TestKubeProxyBuilder_buildPod(t *testing.T) {
9686
v1.ResourceCPU: *resource.NewScaledQuantity(30, resource.Milli),
9787
},
9888
},
99-
Command: exec.WithTee("/usr/local/bin/kube-proxy", sortedStrings(flags), "/var/log/kube-proxy.log"),
89+
Command: []string{"/go-runner"},
10090
},
10191
},
10292
},
@@ -147,6 +137,11 @@ func TestKubeProxyBuilder_buildPod(t *testing.T) {
147137
if !reflect.DeepEqual(got.Spec.Containers[0].Resources, tt.want.Spec.Containers[0].Resources) {
148138
t.Errorf("KubeProxyBuilder.buildPod() Resources = %v, want %v", got.Spec.Containers[0].Resources, tt.want.Spec.Containers[0].Resources)
149139
}
140+
141+
// compare pod spec container command
142+
if !reflect.DeepEqual(got.Spec.Containers[0].Command, tt.want.Spec.Containers[0].Command) {
143+
t.Errorf("KubeProxyBuilder.buildPod() Command = %v, want %v", got.Spec.Containers[0].Command, tt.want.Spec.Containers[0].Command)
144+
}
150145
})
151146
}
152147
}

0 commit comments

Comments
 (0)