call T.Fatalf() for nil ptr

This commit is contained in:
Gaurav Singh 2020-04-11 11:15:40 -04:00
parent a7f43a7203
commit fe8d468633

View File

@ -37,7 +37,7 @@ func TestFSGroupMount(t *testing.T) {
} }
s := info.Sys().(*syscall.Stat_t) s := info.Sys().(*syscall.Stat_t)
if s == nil { if s == nil {
t.Errorf("Error getting stats for %s (%v)", tmpDir, err) t.Fatalf("Error getting stats for %s (%v)", tmpDir, err)
} }
fsGroup1 := int64(s.Gid) fsGroup1 := int64(s.Gid)
fsGroup2 := fsGroup1 + 1 fsGroup2 := fsGroup1 + 1
@ -60,7 +60,7 @@ func TestFSGroupMount(t *testing.T) {
//Checking if GID of tmpDir has not been changed by mounting it by second pod //Checking if GID of tmpDir has not been changed by mounting it by second pod
s = info.Sys().(*syscall.Stat_t) s = info.Sys().(*syscall.Stat_t)
if s == nil { if s == nil {
t.Errorf("Error getting stats for %s (%v)", tmpDir, err) t.Fatalf("Error getting stats for %s (%v)", tmpDir, err)
} }
if fsGroup1 != int64(s.Gid) { if fsGroup1 != int64(s.Gid) {
t.Errorf("Old Gid %d for volume %s got overwritten by new Gid %d", fsGroup1, tmpDir, int64(s.Gid)) t.Errorf("Old Gid %d for volume %s got overwritten by new Gid %d", fsGroup1, tmpDir, int64(s.Gid))