소스 검색

add TEST env var during tests and silenced parserun during tests

Victor Vieux 12 년 전
부모
커밋
eee6d3dae9
2개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 0
      a_test.go
  2. 1 1
      container.go

+ 10 - 0
a_test.go

@@ -0,0 +1,10 @@
+package docker
+
+import (
+	"os"
+	"testing"
+)
+
+func Test(t *testing.T) {
+	os.Setenv("TEST", "1")
+}

+ 1 - 1
container.go

@@ -107,7 +107,7 @@ type KeyValuePair struct {
 
 func ParseRun(args []string, capabilities *Capabilities) (*Config, *HostConfig, *flag.FlagSet, error) {
 	cmd := Subcmd("run", "[OPTIONS] IMAGE [COMMAND] [ARG...]", "Run a command in a new container")
-	if len(args) > 0 && args[0] != "--help" {
+	if os.Getenv("TEST") != "" {
 		cmd.SetOutput(ioutil.Discard)
 		cmd.Usage = nil
 	}