diff --git a/pkg/volume/metrics_block_test.go b/pkg/volume/metrics_block_test.go index bd644422928..a68803148d4 100644 --- a/pkg/volume/metrics_block_test.go +++ b/pkg/volume/metrics_block_test.go @@ -17,9 +17,6 @@ limitations under the License. package volume_test import ( - "io/fs" - "os" - "runtime" "testing" . "k8s.io/kubernetes/pkg/volume" @@ -46,53 +43,3 @@ func TestGetMetricsBlockInvalid(t *testing.T) { t.Errorf("Expected error when calling GetMetrics on incorrectly initialized MetricsBlock, actual nil") } } - -func TestGetMetricsBlock(t *testing.T) { - // FIXME: this test is Linux specific - if runtime.GOOS == "windows" { - t.Skip("Block device detection is Linux specific, no Windows support") - } - - // find a block device - // get all available block devices - // - ls /sys/block - devices, err := os.ReadDir("/dev") - if err != nil { - t.Skipf("Could not read devices from /dev: %v", err) - } else if len(devices) == 0 { - t.Skip("No devices found") - } - - // for each device, check if it is available in /dev - devNode := "" - var stat fs.FileInfo - for _, device := range devices { - // if the device exists, use it, return - devNode = "/dev/" + device.Name() - stat, err = os.Stat(devNode) - if err == nil { - if stat.Mode().Type() == fs.ModeDevice { - break - } - } - // set to an empty string, so we can do validation of the last - // device too - devNode = "" - } - - // if no devices are found, or none exists in /dev, skip this part - if devNode == "" { - t.Skip("Could not find a block device under /dev") - } - - // when we get here, devNode points to an existing block device - metrics := NewMetricsBlock(devNode) - actual, err := metrics.GetMetrics() - if err != nil { - t.Errorf("Unexpected error when calling GetMetrics: %v", err) - } - - if a := actual.Capacity.Value(); a <= 0 { - t.Errorf("Expected Capacity %d to be greater than 0.", a) - } -}