@@ -32,7 +32,6 @@ import (
3232 "github.com/stretchr/testify/assert"
3333 "github.com/stretchr/testify/require"
3434
35- "github.com/firecracker-microvm/firecracker-containerd/config"
3635 "github.com/firecracker-microvm/firecracker-containerd/internal"
3736 "github.com/firecracker-microvm/firecracker-containerd/internal/integtest"
3837 "github.com/firecracker-microvm/firecracker-containerd/proto"
@@ -45,11 +44,11 @@ func TestCNISupport_Isolated(t *testing.T) {
4544 ctx , cancel := context .WithTimeout (namespaces .WithNamespace (context .Background (), defaultNamespace ), testTimeout )
4645 defer cancel ()
4746
48- client , err := containerd .New (containerdSockPath , containerd .WithDefaultRuntime (firecrackerRuntime ))
49- require .NoError (t , err , "unable to create client to containerd service at %s, is containerd running?" , containerdSockPath )
47+ client , err := containerd .New (integtest . ContainerdSockPath , containerd .WithDefaultRuntime (firecrackerRuntime ))
48+ require .NoError (t , err , "unable to create client to containerd service at %s, is containerd running?" , integtest . ContainerdSockPath )
5049 defer client .Close ()
5150
52- fcClient , err := newFCControlClient ( containerdSockPath )
51+ fcClient , err := integtest . NewFCControlClient ( integtest . ContainerdSockPath )
5352 require .NoError (t , err , "failed to create fccontrol client" )
5453
5554 image , err := alpineImage (ctx , client , defaultSnapshotterName )
@@ -148,14 +147,14 @@ func TestCNISupport_Isolated(t *testing.T) {
148147}
149148
150149func TestAutomaticCNISupport_Isolated (t * testing.T ) {
151- integtest .Prepare (t , withDefaultNetwork ())
150+ integtest .Prepare (t , integtest . WithDefaultNetwork ())
152151
153152 testTimeout := 120 * time .Second
154153 ctx , cancel := context .WithTimeout (namespaces .WithNamespace (context .Background (), defaultNamespace ), testTimeout )
155154 defer cancel ()
156155
157- client , err := containerd .New (containerdSockPath , containerd .WithDefaultRuntime (firecrackerRuntime ))
158- require .NoError (t , err , "unable to create client to containerd service at %s, is containerd running?" , containerdSockPath )
156+ client , err := containerd .New (integtest . ContainerdSockPath , containerd .WithDefaultRuntime (firecrackerRuntime ))
157+ require .NoError (t , err , "unable to create client to containerd service at %s, is containerd running?" , integtest . ContainerdSockPath )
159158 defer client .Close ()
160159
161160 image , err := alpineImage (ctx , client , defaultSnapshotterName )
@@ -226,11 +225,11 @@ func TestCNIPlugin_Performance(t *testing.T) {
226225 ctx , cancel := context .WithTimeout (namespaces .WithNamespace (context .Background (), defaultNamespace ), testTimeout )
227226 defer cancel ()
228227
229- client , err := containerd .New (containerdSockPath , containerd .WithDefaultRuntime (firecrackerRuntime ))
230- require .NoError (t , err , "unable to create client to containerd service at %s, is containerd running?" , containerdSockPath )
228+ client , err := containerd .New (integtest . ContainerdSockPath , containerd .WithDefaultRuntime (firecrackerRuntime ))
229+ require .NoError (t , err , "unable to create client to containerd service at %s, is containerd running?" , integtest . ContainerdSockPath )
231230 defer client .Close ()
232231
233- fcClient , err := newFCControlClient ( containerdSockPath )
232+ fcClient , err := integtest . NewFCControlClient ( integtest . ContainerdSockPath )
234233 require .NoError (t , err , "failed to create ttrpc client" )
235234
236235 image , err := iperf3Image (ctx , client , defaultSnapshotterName )
@@ -362,19 +361,6 @@ func writeCNIConf(path, chainedPluginName, networkName, nameserver string) error
362361}` , networkName , nameserver , chainedPluginName )), 0644 )
363362}
364363
365- func withDefaultNetwork () func (c * config.Config ) {
366- return func (c * config.Config ) {
367- c .DefaultNetworkInterfaces = []proto.FirecrackerNetworkInterface {
368- {
369- CNIConfig : & proto.CNIConfiguration {
370- NetworkName : "fcnet" ,
371- InterfaceName : "veth0" ,
372- },
373- },
374- }
375- }
376- }
377-
378364func runCommand (ctx context.Context , t * testing.T , name string , args ... string ) {
379365 t .Helper ()
380366 output , err := exec .CommandContext (ctx , name , args ... ).CombinedOutput ()
0 commit comments