Skip to content

Commit c0c028b

Browse files
authored
Merge pull request #393 from kzys/run-multivm-test-again
Run TestMultipleVMs_Isolated on Docker-based build again
2 parents 4ff9d06 + b8ecac4 commit c0c028b

File tree

1 file changed

+3
-36
lines changed

1 file changed

+3
-36
lines changed

runtime/service_integ_test.go

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"bytes"
1818
"context"
1919
"fmt"
20-
"io"
2120
"io/ioutil"
2221
"os"
2322
"os/exec"
@@ -245,39 +244,7 @@ func createTapDevice(ctx context.Context, tapName string) error {
245244
return nil
246245
}
247246

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-
262247
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) {
281248
prepareIntegTest(t)
282249

283250
netns, err := ns.GetCurrentNS()
@@ -377,7 +344,7 @@ func (runner *testMultipleVMsRunner) TestMultipleVMs(t *testing.T) {
377344
containerWg.Add(1)
378345
go func(containerID int) {
379346
defer containerWg.Done()
380-
runner.testMultipleExecs(
347+
testMultipleExecs(
381348
ctx,
382349
t,
383350
vmID,
@@ -422,7 +389,7 @@ func (runner *testMultipleVMsRunner) TestMultipleVMs(t *testing.T) {
422389
vmWg.Wait()
423390
}
424391

425-
func (runner *testMultipleVMsRunner) testMultipleExecs(
392+
func testMultipleExecs(
426393
ctx context.Context,
427394
t *testing.T,
428395
vmID int,
@@ -455,7 +422,7 @@ func (runner *testMultipleVMsRunner) testMultipleExecs(
455422
),
456423
)
457424
require.NoError(t, err, "failed to create container %s", containerName)
458-
runner.containers = append(runner.containers, newContainer)
425+
defer newContainer.Delete(ctx)
459426

460427
var taskStdout bytes.Buffer
461428
var taskStderr bytes.Buffer

0 commit comments

Comments
 (0)