Skip to content

Commit

Permalink
Merge pull request kubernetes#117616 from claudiubelu/fix-kubelet-uti…
Browse files Browse the repository at this point in the history
…l-windows-ut

unit tests: Fixes kubelet util unit tests for Windows
  • Loading branch information
k8s-ci-robot authored May 11, 2023
2 parents 006c011 + 11f1d24 commit 122a459
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/kubelet/util/util_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"fmt"
"net"
"net/url"
"os"
"path/filepath"
"strings"
"syscall"
Expand Down Expand Up @@ -165,6 +166,11 @@ func IsUnixDomainSocket(filePath string) (bool, error) {
// does NOT work in 1809 if the socket file is created within a bind mounted directory by a container
// and the FSCTL is issued in the host by the kubelet.

// If the file does not exist, it cannot be a Unix domain socket.
if _, err := os.Stat(filePath); os.IsNotExist(err) {
return false, fmt.Errorf("File %s not found. Err: %v", filePath, err)
}

klog.V(6).InfoS("Function IsUnixDomainSocket starts", "filePath", filePath)
// As detailed in https://github.com/kubernetes/kubernetes/issues/104584 we cannot rely
// on the Unix Domain socket working on the very first try, hence the potential need to
Expand Down
2 changes: 2 additions & 0 deletions pkg/kubelet/util/util_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ package util
import (
"fmt"
"math/rand"
"net"
"os"
"reflect"
"runtime"
"sync"
Expand Down

0 comments on commit 122a459

Please sign in to comment.