Micro Benchmarks: multiples runtimes (#268)

* Micro benchmarks: use container.Runtime to kill container

Signed-off-by: Julio Montes <julio.montes@intel.com>

* Micro benchmarks: add support for multiples runtimes

Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
Julio Montes 2016-06-16 16:39:19 -05:00 committed by Michael Crosby
parent 2d2dfab85a
commit 0227e9fb94
3 changed files with 13 additions and 4 deletions

View file

@ -9,6 +9,7 @@ import (
"syscall"
"testing"
"time"
"flag"
utils "github.com/docker/containerd/testutils"
)
@ -16,6 +17,7 @@ import (
var (
devNull = "/dev/null"
stdin io.WriteCloser
runtimeTool = flag.String("runtime", "runc", "Runtime to use for this test")
)
// Create containerd state and oci bundles directory
@ -145,7 +147,7 @@ func BenchmarkBusyboxSh(b *testing.B) {
Root: utils.StateDir,
ID: bundleName,
Bundle: filepath.Join(wd, bundlePath),
Runtime: "runc",
Runtime: *runtimeTool,
Shim: "containerd-shim",
Timeout: 15 * time.Second,
})
@ -165,7 +167,7 @@ func benchmarkStartContainer(b *testing.B, c Container, s Stdio, bundleName stri
b.Fatalf("Error starting container %v", err)
}
kill := exec.Command("runc", "kill", bundleName, "KILL")
kill := exec.Command(c.Runtime(), "kill", bundleName, "KILL")
kill.Run()
// wait for kill to finish. selected wait time is arbitrary