Skip to content

Commit 8e15d83

Browse files
committed
Test UpdateGuestNetworkInterface()
But passing "1" twice doesn't look right.
1 parent 16e9b9b commit 8e15d83

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

machine_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,13 @@ func TestMicroVMExecution(t *testing.T) {
275275

276276
vmlinuxPath := getVmlinuxPath(t)
277277

278+
networkIfaces := []NetworkInterface{
279+
{
280+
MacAddress: "01-23-45-67-89-AB-CD-EF",
281+
HostDevName: "tap0",
282+
},
283+
}
284+
278285
cfg := Config{
279286
SocketPath: socketPath,
280287
LogFifo: logFifo,
@@ -288,6 +295,7 @@ func TestMicroVMExecution(t *testing.T) {
288295
},
289296
Debug: true,
290297
DisableValidation: true,
298+
NetworkInterfaces: networkIfaces,
291299
}
292300

293301
ctx := context.Background()
@@ -332,6 +340,7 @@ func TestMicroVMExecution(t *testing.T) {
332340
t.Run("TestAttachVsock", func(t *testing.T) { testAttachVsock(ctx, t, m) })
333341
t.Run("SetMetadata", func(t *testing.T) { testSetMetadata(ctx, t, m) })
334342
t.Run("TestUpdateGuestDrive", func(t *testing.T) { testUpdateGuestDrive(ctx, t, m) })
343+
t.Run("TestUpdateGuestNetworkInterface", func(t *testing.T) { testUpdateGuestNetworkInterface(ctx, t, m) })
335344
t.Run("TestStartInstance", func(t *testing.T) { testStartInstance(ctx, t, m) })
336345

337346
// Let the VMM start and stabilize...
@@ -489,6 +498,12 @@ func testUpdateGuestDrive(ctx context.Context, t *testing.T, m *Machine) {
489498
}
490499
}
491500

501+
func testUpdateGuestNetworkInterface(ctx context.Context, t *testing.T, m *Machine) {
502+
if err := m.UpdateGuestNetworkInterface(ctx, "1", models.PartialNetworkInterface{IfaceID: String("1")}); err != nil {
503+
t.Fatalf("Failed to update the network interface %v", err)
504+
}
505+
}
506+
492507
func testCreateNetworkInterfaceByID(ctx context.Context, t *testing.T, m *Machine) {
493508
if skipTuntap {
494509
t.Skip("Skipping: tuntap tests explicitly disabled")

0 commit comments

Comments
 (0)