devmapper: more precise way of checking if device is activated

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
This commit is contained in:
Maksym Pavlenko
2019-02-21 15:43:39 -08:00
parent 37cdedc61c
commit 7efda48c53
2 changed files with 24 additions and 14 deletions

View File

@@ -191,12 +191,13 @@ func testDeactivateThinDevice(t *testing.T, pool *PoolDevice) {
}
for _, deviceName := range deviceList {
assert.Assert(t, pool.IsActivated(deviceName))
err := pool.DeactivateDevice(context.Background(), deviceName, false)
assert.NilError(t, err, "failed to remove '%s'", deviceName)
}
err := pool.DeactivateDevice(context.Background(), "not-existing-device", false)
assert.Assert(t, err != nil, "should return an error if trying to remove not existing device")
assert.Assert(t, !pool.IsActivated(deviceName))
}
}
func testRemoveThinDevice(t *testing.T, pool *PoolDevice) {