@@ -20,6 +20,7 @@ import (
2020 "net"
2121 "os"
2222 "path/filepath"
23+ "runtime"
2324 "sync"
2425 "testing"
2526 "time"
@@ -253,7 +254,7 @@ func testNetworkMachineCNI(t *testing.T, useConfFile bool) {
253254 }
254255 fctesting .RequiresRoot (t )
255256
256- cniBinPath := []string {"/opt/cni/bin" , testDataBin }
257+ cniBinPath := []string {testDataBin , "/opt/cni/bin" }
257258
258259 dir , err := ioutil .TempDir ("" , fsSafeTestName .Replace (t .Name ()))
259260 require .NoError (t , err )
@@ -312,63 +313,67 @@ func testNetworkMachineCNI(t *testing.T, useConfFile bool) {
312313 require .NoError (t , err , "cni conf should parse" )
313314 }
314315
315- numVMs := 10
316- vmIPs := make (chan string , numVMs )
316+ if runtime .GOARCH == "arm64" {
317+ t .Skip ()
318+ } else {
319+ numVMs := 10
320+ vmIPs := make (chan string , numVMs )
317321
318- // used as part of the VMIDs to make sure different test suites don't use the same CNI ContainerID (which can reak havok)
319- timestamp := time .Now ().UnixNano ()
322+ // used as part of the VMIDs to make sure different test suites don't use the same CNI ContainerID (which can reak havok)
323+ timestamp := time .Now ().UnixNano ()
320324
321- var vmWg sync.WaitGroup
322- for i := 0 ; i < numVMs ; i ++ {
323- vmWg .Add (1 )
325+ var vmWg sync.WaitGroup
326+ for i := 0 ; i < numVMs ; i ++ {
327+ vmWg .Add (1 )
324328
325- vmID := fmt .Sprintf ("%d-%s-%d" , timestamp , networkName , i )
329+ vmID := fmt .Sprintf ("%d-%s-%d" , timestamp , networkName , i )
326330
327- firecrackerSockPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.sock" , vmID ))
328- rootfsPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.img" , vmID ))
331+ firecrackerSockPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.sock" , vmID ))
332+ rootfsPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.img" , vmID ))
329333
330- ctx , cancel := context .WithCancel (context .Background ())
331- // NewMachine cannot be in the goroutine below, since go-openapi/runtime has a globally-shared mutable logger...
332- // https://github.com/go-openapi/runtime/blob/553c9d1fb273d9550562d9f76949a413af265138/client/runtime.go#L463
333- m := newCNIMachine (t , ctx , firecrackerSockPath , rootfsPath , cniConfDir , cniCacheDir , networkName , ifName , vmID , cniBinPath , networkConf )
334+ ctx , cancel := context .WithCancel (context .Background ())
335+ // NewMachine cannot be in the goroutine below, since go-openapi/runtime has a globally-shared mutable logger...
336+ // https://github.com/go-openapi/runtime/blob/553c9d1fb273d9550562d9f76949a413af265138/client/runtime.go#L463
337+ m := newCNIMachine (t , ctx , firecrackerSockPath , rootfsPath , cniConfDir , cniCacheDir , networkName , ifName , vmID , cniBinPath , networkConf )
334338
335- go func (ctx context.Context , cancel func (), m * Machine , vmID string ) {
336- defer vmWg .Done ()
337- defer cancel ()
339+ go func (ctx context.Context , cancel func (), m * Machine , vmID string ) {
340+ defer vmWg .Done ()
341+ defer cancel ()
338342
339- expectedCacheDirPath := filepath .Join (cniCacheDir , "results" ,
340- fmt .Sprintf ("%s-%s-%s" , networkName , vmID , ifName ))
343+ expectedCacheDirPath := filepath .Join (cniCacheDir , "results" ,
344+ fmt .Sprintf ("%s-%s-%s" , networkName , vmID , ifName ))
341345
342- vmIP := startCNIMachine (t , ctx , m )
343- vmIPs <- vmIP
346+ vmIP := startCNIMachine (t , ctx , m )
347+ vmIPs <- vmIP
344348
345- assert .FileExists (t , expectedCacheDirPath , "CNI cache dir doesn't exist after vm startup" )
349+ assert .FileExists (t , expectedCacheDirPath , "CNI cache dir doesn't exist after vm startup" )
346350
347- testPing (t , vmIP , 3 , 5 * time .Second )
351+ testPing (t , vmIP , 3 , 5 * time .Second )
348352
349- require .NoError (t , m .StopVMM (), "failed to stop machine" )
350- waitCtx , waitCancel := context .WithTimeout (ctx , 3 * time .Second )
353+ require .NoError (t , m .StopVMM (), "failed to stop machine" )
354+ waitCtx , waitCancel := context .WithTimeout (ctx , 3 * time .Second )
351355
352- // Having an error is fine, since StopVM() kills a Firecracker process.
353- // Shutdown() uses SendCtrAltDel action, which doesn't work with the kernel we are using here.
354- // https://github.com/firecracker-microvm/firecracker/issues/1095
355- assert .NotEqual (t , m .Wait (waitCtx ), context .DeadlineExceeded , "failed waiting for machine stop" )
356- waitCancel ()
356+ // Having an error is fine, since StopVM() kills a Firecracker process.
357+ // Shutdown() uses SendCtrAltDel action, which doesn't work with the kernel we are using here.
358+ // https://github.com/firecracker-microvm/firecracker/issues/1095
359+ assert .NotEqual (t , m .Wait (waitCtx ), context .DeadlineExceeded , "failed waiting for machine stop" )
360+ waitCancel ()
357361
358- _ , err := os .Stat (expectedCacheDirPath )
359- assert .True (t , os .IsNotExist (err ), "expected CNI cache dir to not exist after vm exit" )
362+ _ , err := os .Stat (expectedCacheDirPath )
363+ assert .True (t , os .IsNotExist (err ), "expected CNI cache dir to not exist after vm exit" )
360364
361- }(ctx , cancel , m , vmID )
362- }
363- vmWg .Wait ()
364- close (vmIPs )
365-
366- vmIPSet := make (map [string ]bool )
367- for vmIP := range vmIPs {
368- if _ , ok := vmIPSet [vmIP ]; ok {
369- assert .Failf (t , "unexpected duplicate vm IP %s" , vmIP )
370- } else {
371- vmIPSet [vmIP ] = true
365+ }(ctx , cancel , m , vmID )
366+ }
367+ vmWg .Wait ()
368+ close (vmIPs )
369+
370+ vmIPSet := make (map [string ]bool )
371+ for vmIP := range vmIPs {
372+ if _ , ok := vmIPSet [vmIP ]; ok {
373+ assert .Failf (t , "unexpected duplicate vm IP %s" , vmIP )
374+ } else {
375+ vmIPSet [vmIP ] = true
376+ }
372377 }
373378 }
374379}
@@ -405,7 +410,6 @@ func newCNIMachine(t *testing.T,
405410 MachineCfg : models.MachineConfiguration {
406411 VcpuCount : Int64 (2 ),
407412 MemSizeMib : Int64 (256 ),
408- Smt : Bool (true ),
409413 },
410414 Drives : []models.Drive {
411415 {
0 commit comments