@@ -17,7 +17,6 @@ import (
17
17
"bytes"
18
18
"context"
19
19
"fmt"
20
- "io"
21
20
"io/ioutil"
22
21
"os"
23
22
"os/exec"
@@ -245,39 +244,7 @@ func createTapDevice(ctx context.Context, tapName string) error {
245
244
return nil
246
245
}
247
246
248
- type testMultipleVMsRunner struct {
249
- containers []containerd.Container
250
- }
251
-
252
- func (runner * testMultipleVMsRunner ) ImportPath () string { return "" }
253
- func (runner * testMultipleVMsRunner ) MatchString (pat , str string ) (bool , error ) {
254
- return pat == str , nil
255
- }
256
- func (runner * testMultipleVMsRunner ) StartCPUProfile (w io.Writer ) error { return nil }
257
- func (runner * testMultipleVMsRunner ) StopCPUProfile () {}
258
- func (runner * testMultipleVMsRunner ) StartTestLog (w io.Writer ) {}
259
- func (runner * testMultipleVMsRunner ) StopTestLog () error { return nil }
260
- func (runner * testMultipleVMsRunner ) WriteProfileTo (str string , w io.Writer , n int ) error { return nil }
261
-
262
247
func TestMultipleVMs_Isolated (t * testing.T ) {
263
- runner := & testMultipleVMsRunner {}
264
- tests := []testing.InternalTest {
265
- {
266
- Name : "TestMultipleVMs_Isolated" ,
267
- F : runner .TestMultipleVMs ,
268
- },
269
- }
270
- m := testing .MainStart (runner , tests , nil , nil )
271
- code := m .Run ()
272
- for _ , container := range runner .containers {
273
- err := container .Delete (context .Background ())
274
- t .Log (err )
275
- }
276
-
277
- os .Exit (code )
278
- }
279
-
280
- func (runner * testMultipleVMsRunner ) TestMultipleVMs (t * testing.T ) {
281
248
prepareIntegTest (t )
282
249
283
250
netns , err := ns .GetCurrentNS ()
@@ -377,7 +344,7 @@ func (runner *testMultipleVMsRunner) TestMultipleVMs(t *testing.T) {
377
344
containerWg .Add (1 )
378
345
go func (containerID int ) {
379
346
defer containerWg .Done ()
380
- runner . testMultipleExecs (
347
+ testMultipleExecs (
381
348
ctx ,
382
349
t ,
383
350
vmID ,
@@ -422,7 +389,7 @@ func (runner *testMultipleVMsRunner) TestMultipleVMs(t *testing.T) {
422
389
vmWg .Wait ()
423
390
}
424
391
425
- func ( runner * testMultipleVMsRunner ) testMultipleExecs (
392
+ func testMultipleExecs (
426
393
ctx context.Context ,
427
394
t * testing.T ,
428
395
vmID int ,
@@ -455,7 +422,7 @@ func (runner *testMultipleVMsRunner) testMultipleExecs(
455
422
),
456
423
)
457
424
require .NoError (t , err , "failed to create container %s" , containerName )
458
- runner . containers = append ( runner . containers , newContainer )
425
+ defer newContainer . Delete ( ctx )
459
426
460
427
var taskStdout bytes.Buffer
461
428
var taskStderr bytes.Buffer
0 commit comments