@@ -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,65 @@ 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+ numVMs := 10
318+ vmIPs := make (chan string , numVMs )
317319
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 ()
320+ // used as part of the VMIDs to make sure different test suites don't use the same CNI ContainerID (which can reak havok)
321+ timestamp := time .Now ().UnixNano ()
320322
321- var vmWg sync.WaitGroup
322- for i := 0 ; i < numVMs ; i ++ {
323- vmWg .Add (1 )
323+ var vmWg sync.WaitGroup
324+ for i := 0 ; i < numVMs ; i ++ {
325+ vmWg .Add (1 )
324326
325- vmID := fmt .Sprintf ("%d-%s-%d" , timestamp , networkName , i )
327+ vmID := fmt .Sprintf ("%d-%s-%d" , timestamp , networkName , i )
326328
327- firecrackerSockPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.sock" , vmID ))
328- rootfsPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.img" , vmID ))
329+ firecrackerSockPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.sock" , vmID ))
330+ rootfsPath := filepath .Join (testCNIDir , fmt .Sprintf ("%s.img" , vmID ))
329331
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 )
332+ ctx , cancel := context .WithCancel (context .Background ())
333+ // NewMachine cannot be in the goroutine below, since go-openapi/runtime has a globally-shared mutable logger...
334+ // https://github.com/go-openapi/runtime/blob/553c9d1fb273d9550562d9f76949a413af265138/client/runtime.go#L463
335+ m := newCNIMachine (t , ctx , firecrackerSockPath , rootfsPath , cniConfDir , cniCacheDir , networkName , ifName , vmID , cniBinPath , networkConf )
334336
335- go func (ctx context.Context , cancel func (), m * Machine , vmID string ) {
336- defer vmWg .Done ()
337- defer cancel ()
337+ go func (ctx context.Context , cancel func (), m * Machine , vmID string ) {
338+ defer vmWg .Done ()
339+ defer cancel ()
338340
339- expectedCacheDirPath := filepath .Join (cniCacheDir , "results" ,
340- fmt .Sprintf ("%s-%s-%s" , networkName , vmID , ifName ))
341+ expectedCacheDirPath := filepath .Join (cniCacheDir , "results" ,
342+ fmt .Sprintf ("%s-%s-%s" , networkName , vmID , ifName ))
341343
342- vmIP := startCNIMachine (t , ctx , m )
343- vmIPs <- vmIP
344+ vmIP := startCNIMachine (t , ctx , m )
345+ vmIPs <- vmIP
344346
345- assert .FileExists (t , expectedCacheDirPath , "CNI cache dir doesn't exist after vm startup" )
347+ assert .FileExists (t , expectedCacheDirPath , "CNI cache dir doesn't exist after vm startup" )
346348
347- testPing (t , vmIP , 3 , 5 * time .Second )
349+ testPing (t , vmIP , 3 , 5 * time .Second )
348350
349- require .NoError (t , m .StopVMM (), "failed to stop machine" )
350- waitCtx , waitCancel := context .WithTimeout (ctx , 3 * time .Second )
351+ require .NoError (t , m .StopVMM (), "failed to stop machine" )
352+ waitCtx , waitCancel := context .WithTimeout (ctx , 3 * time .Second )
351353
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 ()
354+ // Having an error is fine, since StopVM() kills a Firecracker process.
355+ // Shutdown() uses SendCtrAltDel action, which doesn't work with the kernel we are using here.
356+ // https://github.com/firecracker-microvm/firecracker/issues/1095
357+ assert .NotEqual (t , m .Wait (waitCtx ), context .DeadlineExceeded , "failed waiting for machine stop" )
358+ waitCancel ()
357359
358- _ , err := os .Stat (expectedCacheDirPath )
359- assert .True (t , os .IsNotExist (err ), "expected CNI cache dir to not exist after vm exit" )
360+ _ , err := os .Stat (expectedCacheDirPath )
361+ assert .True (t , os .IsNotExist (err ), "expected CNI cache dir to not exist after vm exit" )
360362
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
363+ }(ctx , cancel , m , vmID )
364+ }
365+ vmWg .Wait ()
366+ close (vmIPs )
367+
368+ vmIPSet := make (map [string ]bool )
369+ for vmIP := range vmIPs {
370+ if _ , ok := vmIPSet [vmIP ]; ok {
371+ assert .Failf (t , "unexpected duplicate vm IP %s" , vmIP )
372+ } else {
373+ vmIPSet [vmIP ] = true
374+ }
372375 }
373376 }
374377}
@@ -405,7 +408,6 @@ func newCNIMachine(t *testing.T,
405408 MachineCfg : models.MachineConfiguration {
406409 VcpuCount : Int64 (2 ),
407410 MemSizeMib : Int64 (256 ),
408- Smt : Bool (true ),
409411 },
410412 Drives : []models.Drive {
411413 {
0 commit comments