Skip to content

Commit

Permalink
Merge pull request kubernetes#85351 from rosti/kubeadm-fix-kubelet-ve…
Browse files Browse the repository at this point in the history
…rsion-check

kubeadm: Use only stdout when calling kubelet for its version
  • Loading branch information
k8s-ci-robot authored Nov 16, 2019
2 parents 5848ee4 + d425520 commit 01e1dcf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cmd/kubeadm/app/preflight/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ func restoreEnv(e map[string]string) {
}

func TestKubeletVersionCheck(t *testing.T) {
// TODO: Re-enable this test
// fakeexec.FakeCmd supports only combined output.
// Hence .Output() returns a "not supported" error and we cannot use it for the test ATM.
t.Skip()

cases := []struct {
kubeletVersion string
k8sVersion string
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/preflight/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func GetKubeletVersion(execer utilsexec.Interface) (*version.Version, error) {
kubeletVersionRegex := regexp.MustCompile(`^\s*Kubernetes v((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)([-0-9a-zA-Z_\.+]*)?)\s*$`)

command := execer.Command("kubelet", "--version")
out, err := command.CombinedOutput()
out, err := command.Output()
if err != nil {
return nil, errors.Wrap(err, "cannot execute 'kubelet --version'")
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/kubeadm/app/preflight/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ import (
)

func TestGetKubeletVersion(t *testing.T) {
// TODO: Re-enable this test
// fakeexec.FakeCmd supports only combined output.
// Hence .Output() returns a "not supported" error and we cannot use it for the test ATM.
t.Skip()

cases := []struct {
output string
expected string
Expand Down

0 comments on commit 01e1dcf

Please sign in to comment.