From 0d1506adb30ecd56f5e413c3ff376a1acfbe3697 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 4 Dec 2013 16:31:09 -0800 Subject: [PATCH] Move test cpu shares out of test start Fixes #2107 --- integration/container_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/integration/container_test.go b/integration/container_test.go index bcd00994a6..97f4cd282f 100644 --- a/integration/container_test.go +++ b/integration/container_test.go @@ -330,6 +330,36 @@ func TestCommitRun(t *testing.T) { } func TestStart(t *testing.T) { + runtime := mkRuntime(t) + defer nuke(runtime) + container, _, _ := mkContainer(runtime, []string{"-i", "_", "/bin/cat"}, t) + defer runtime.Destroy(container) + + cStdin, err := container.StdinPipe() + if err != nil { + t.Fatal(err) + } + + if err := container.Start(); err != nil { + t.Fatal(err) + } + + // Give some time to the process to start + container.WaitTimeout(500 * time.Millisecond) + + if !container.State.IsRunning() { + t.Errorf("Container should be running") + } + if err := container.Start(); err == nil { + t.Fatalf("A running container should be able to be started") + } + + // Try to avoid the timeout in destroy. Best effort, don't check error + cStdin.Close() + container.WaitTimeout(2 * time.Second) +} + +func TestCpuShares(t *testing.T) { _, err1 := os.Stat("/sys/fs/cgroup/cpuacct,cpu") _, err2 := os.Stat("/sys/fs/cgroup/cpu,cpuacct") if err1 == nil || err2 == nil {