Skip to content

Commit a4ebdce

Browse files
committed
adding test for virtiofs vol
Signed-off-by: Steve Fraser <steve@cast.ai>
1 parent 661fdff commit a4ebdce

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

services/microvm/convert_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,33 @@ func Test_convertToFlintlockAPI(t *testing.T) {
145145
g.Expect(converted.AdditionalVolumes[1].IsReadOnly).To(BeTrue())
146146
},
147147
},
148+
{
149+
name: "withAdditionalVolumes has virtiofs mount",
150+
input: microvm.VMSpec{
151+
AdditionalVolumes: []microvm.Volume{
152+
{
153+
ID: strVal1,
154+
ReadOnly: false,
155+
VirtioFSPath: strVal2,
156+
},
157+
{
158+
ID: strVal3,
159+
Image: strVal4,
160+
ReadOnly: true,
161+
},
162+
},
163+
},
164+
expected: func(g *WithT, converted *flintlocktypes.MicroVMSpec) {
165+
g.Expect(converted.AdditionalVolumes).To(HaveLen(2))
166+
167+
g.Expect(converted.AdditionalVolumes[0].Id).To(Equal(strVal1))
168+
g.Expect(*converted.AdditionalVolumes[0].Source.VirtiofsSource).To(Equal(strVal2))
169+
g.Expect(converted.AdditionalVolumes[0].IsReadOnly).To(BeFalse())
170+
g.Expect(converted.AdditionalVolumes[1].Id).To(Equal(strVal3))
171+
g.Expect(*converted.AdditionalVolumes[1].Source.ContainerSource).To(Equal(strVal4))
172+
g.Expect(converted.AdditionalVolumes[1].IsReadOnly).To(BeTrue())
173+
},
174+
},
148175
{
149176
name: "withAdditionalVolumes, has mountpoint",
150177
input: microvm.VMSpec{

0 commit comments

Comments
 (0)