Skip to content

Commit

Permalink
mount_test: supplement test for checking block device
Browse files Browse the repository at this point in the history
Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>
  • Loading branch information
yuchen0cc committed Nov 22, 2023
1 parent 02042f2 commit a749dd1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/runtime/virtcontainers/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ func TestCheckBlockDevice(t *testing.T) {
isBD, err = checkBlockDevice(major, minor)
assert.NoError(err)
assert.True(isBD)

// invalid template
blockFormatTemplates = map[string]string{
"/dev/invalid": "\000/sys/dev/char/%d:%d",
}
isBD, err = checkBlockDevice(major, minor)
assert.Error(err)
assert.False(isBD)
}

func TestIsDockerVolume(t *testing.T) {
Expand Down

0 comments on commit a749dd1

Please sign in to comment.