test/rbd: check for expected errors with Image.Open()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2019-12-10 14:02:55 +01:00 committed by John Mulligan
parent 22c15e5a37
commit f611d4a986
1 changed files with 6 additions and 1 deletions

View File

@ -226,7 +226,7 @@ func TestGetImageNames(t *testing.T) {
conn.Shutdown()
}
func TestImageReadOnly(t *testing.T) {
func TestImageOpen(t *testing.T) {
conn, _ := rados.NewConn()
conn.ReadDefaultConfigFile()
conn.Connect()
@ -242,6 +242,11 @@ func TestImageReadOnly(t *testing.T) {
image, err := Create(ioctx, name, 1<<22, 22)
assert.NoError(t, err)
// an integer is not a valid argument
err = image.Open(123)
assert.Error(t, err)
// open read-only
err = image.Open(true)
assert.NoError(t, err)