mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-29 21:03:56 +00:00
unittests: Fixes unit tests for Windows (part 7)
Currently, there are some unit tests that are failing on Windows due to various reasons: - if a powershell command that could return an array (e.g.: Get-Disk) would return an array of only one element, powershell will in fact return that object directly, and **not** an array containing that element. In a few cases, these commands are used and their output is converted to json, after which they're unmarshalled in golang, with the expectation that the unmarshalled data to be an array. If it's not an array, we get an error. - when mounting Block Devices, Windows expects the given source to be a Disk Number, not a path. - for rbd_windows_test.go, we should start with Disk Number 0, which exists on all hosts. - if a Disk has multiple volumes, Get-Volume doesn't return the volumes in the same order. This can result in various assertions failing. - the pkg/volume/rbd/rdb_test.TestPlugin test expects that mounter.MountSensitive is called when attacher.MountDevice is called. The Windows attacher doesn't currently make that call.
This commit is contained in:
@@ -359,11 +359,6 @@ type testcase struct {
|
||||
}
|
||||
|
||||
func TestPlugin(t *testing.T) {
|
||||
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("Skipping test that fails on Windows")
|
||||
}
|
||||
|
||||
tmpDir, err := utiltesting.MkTmpdir("rbd_test")
|
||||
if err != nil {
|
||||
t.Fatalf("error creating temp dir: %v", err)
|
||||
@@ -374,10 +369,10 @@ func TestPlugin(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expectedDevicePath := "/dev/rbd1"
|
||||
expectedDevicePath := "/dev/rbd0"
|
||||
if runtime.GOOS == "windows" {
|
||||
// Windows expects Disk Numbers.
|
||||
expectedDevicePath = "1"
|
||||
expectedDevicePath = "0"
|
||||
}
|
||||
|
||||
podUID := uuid.NewUUID()
|
||||
|
||||
Reference in New Issue
Block a user