Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable unit testing on windows #1219

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Enable unit testing on windows
Signed-off-by: Eddie Torres <torredil@amazon.com>
  • Loading branch information
torredil committed Apr 26, 2022
commit f48b9795f46edbed65374187df54ff8ee1435dac
3 changes: 3 additions & 0 deletions pkg/driver/mount_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build linux
// +build linux

/*
Copyright 2020 The Kubernetes Authors.

Expand Down
3 changes: 3 additions & 0 deletions pkg/driver/node_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build linux
// +build linux

/*
Copyright 2019 The Kubernetes Authors.

Expand Down
3 changes: 3 additions & 0 deletions pkg/driver/sanity_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build linux
// +build linux

package driver

import (
Expand Down
311 changes: 311 additions & 0 deletions pkg/mounter/mock_mount_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pkg/mounter/safe_mounter_unix_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build linux
// +build linux

/*
Copyright 2020 The Kubernetes Authors.

Expand Down
19 changes: 18 additions & 1 deletion pkg/mounter/safe_mounter_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,24 @@ import (
utilexec "k8s.io/utils/exec"
)

var _ mount.Interface = &CSIProxyMounter{}
var _ ProxyMounter = &CSIProxyMounter{}

type ProxyMounter interface {
mount.Interface

Rmdir(path string) error
WriteVolumeCache(target string)
IsMountPointMatch(mp mount.MountPoint, dir string) bool
GetDeviceNameFromMount(mountPath, pluginMountDir string) (string, error)
MakeFile(pathname string) error
ExistsPath(path string) (bool, error)
Rescan() error
FindDiskByLun(lun string) (diskNum string, err error)
FormatAndMount(source, target, fstype string, options []string) error
ResizeVolume(deviceMountPath string) (bool, error)
GetVolumeSizeInBytes(deviceMountPath string) (int64, error)
GetDeviceSize(devicePath string) (int64, error)
}

type CSIProxyMounter struct {
FsClient *fsclient.Client
Expand Down
6 changes: 3 additions & 3 deletions pkg/resizefs/resizefs_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (

// resizeFs provides support for resizing file systems
type resizeFs struct {
proxy *mounter.CSIProxyMounter
proxy mounter.ProxyMounter
}

// NewResizeFs returns an instance of resizeFs
func NewResizeFs(proxy *mounter.CSIProxyMounter) *resizeFs {
return &resizeFs{proxy: proxy}
func NewResizeFs(p mounter.ProxyMounter) *resizeFs {
return &resizeFs{proxy: p}
}

// Resize performs resize of file system
Expand Down
Loading