Change:
On a clean Ubuntu dev environment I get the following error when I executed the I think that the tests should not fail and should handle the case where there is a cdrom device but there is not an actual CD media inserted. I got feedback from and this is also happing on his environment with the following error: I am coping also his comment from the slack that may help: Looks like it's not a problem with cdrom, but some dependence on device. I don't think it should try try to access at all. This is my very first issue, I am new to this, any help is welcome. I am really looking forward to starting coding but I am overwhelmed with the amount of information that I need to digest. /cc serathius /sig instrumentation
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the label and provide further guidance. The label can be by org members by writing in a comment. <detailsInstructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
Fact that this tests fails only locally and not on CI means that there will not be a lot of interest in fixing it. Feel free to prepare a fix for it. Please let me know if you need help with setting up development workflow.
this is probably related to Because other tests have this same issue, CI is still running unit tests as UID=0. I have work to remove that but I wasn't sure about another storage test.
The block metrics tests were introduced in - I am fine with deleting the test in question. We have e2e that captures this more accurately and unit test seems kinda less useful anyways.
opened to remove the test. I think we should be fine without it.
Thank you! Also just for the record noting that I can of course locally reproduce this (with in my case).
thanks all. similar issues are tracked in ,

Discussion:
package volume_test import ( <del> "io/fs" "os" "runtime" </del> "testing" . "k8s.io/kubernetes/pkg/volume"

t.Errorf("Expected error when calling GetMetrics on incorrectly initialized MetricsBlock, actual nil") } } <del> 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) } } </del>