Merge pull request #110931 from claudiubelu/adds-unittests-3

tests: Ports volume unit tests to Windows
This commit is contained in:
Kubernetes Prow Robot
2023-01-05 05:31:58 -08:00
committed by GitHub
7 changed files with 302 additions and 215 deletions

View File

@@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path/filepath"
goruntime "runtime"
"strings"
"sync"
"testing"
@@ -1269,6 +1270,11 @@ func (fv *FakeVolumePathHandler) GetLoopDevice(path string) (string, error) {
// FindEmptyDirectoryUsageOnTmpfs finds the expected usage of an empty directory existing on
// a tmpfs filesystem on this system.
func FindEmptyDirectoryUsageOnTmpfs() (*resource.Quantity, error) {
// The command below does not exist on Windows. Additionally, empty folders have size 0 on Windows.
if goruntime.GOOS == "windows" {
used, err := resource.ParseQuantity("0")
return &used, err
}
tmpDir, err := utiltesting.MkTmpdir("metrics_du_test")
if err != nil {
return nil, err