csi: let constructor take care of setting up cryptsetup (#2312)

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-09-06 15:05:59 +02:00 committed by GitHub
parent d3c940a6a0
commit 327315d5de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 10 deletions

View file

@ -57,7 +57,11 @@ func TestCloseCryptDevice(t *testing.T) {
})
}
mapper := New(&fakeKMS{}, &stubCryptDevice{})
mapper := &CryptMapper{
mapper: &stubCryptDevice{},
kms: &fakeKMS{},
getDiskFormat: getDiskFormat,
}
err := mapper.CloseCryptDevice("volume01-unit-test")
assert.NoError(t, err)
}
@ -214,7 +218,11 @@ func TestOpenCryptDevice(t *testing.T) {
})
}
mapper := New(&fakeKMS{}, &stubCryptDevice{})
mapper := &CryptMapper{
mapper: &stubCryptDevice{},
kms: &fakeKMS{},
getDiskFormat: getDiskFormat,
}
_, err := mapper.OpenCryptDevice(context.Background(), "/dev/some-device", "volume01", false)
assert.NoError(t, err)
}