Merge pull request #103127 from PushkarJ/pkg-vol-csi-non-root-test-fix

Fix panic in pkg/volume/csi tests
This commit is contained in:
Kubernetes Prow Robot 2021-06-25 06:38:44 -07:00 committed by GitHub
commit 55c0d318bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1187,9 +1187,13 @@ func TestAttacherMountDevice(t *testing.T) {
}
for _, tc := range testCases {
user, _ := user.Current()
if tc.populateDeviceMountPath && user.Uid == "0" {
t.Skipf("Skipping intentional failure on existing data when running as root.")
user, err := user.Current()
if err != nil {
t.Logf("Current user could not be determined, assuming non-root: %v", err)
} else {
if tc.populateDeviceMountPath && user.Uid == "0" {
t.Skipf("Skipping intentional failure on existing data when running as root.")
}
}
t.Run(tc.testName, func(t *testing.T) {
t.Logf("Running test case: %s", tc.testName)