Skip to content

Commit

Permalink
test for when equals is set
Browse files Browse the repository at this point in the history
  • Loading branch information
csquared committed Nov 21, 2015
1 parent 370e227 commit 09d8630
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
26 changes: 26 additions & 0 deletions cmd/convox/start_test.go
Expand Up @@ -15,6 +15,13 @@ var manifestRequired string = `www:
image: httpd
`

var manifestExplicitEqual string = `www:
environment:
- FOO=
image: httpd
command: sh
`

func TestStartWithMissingEnv(t *testing.T) {
temp, _ := ioutil.TempDir("", "convox-test")
appDir := temp + "/app"
Expand All @@ -33,3 +40,22 @@ func TestStartWithMissingEnv(t *testing.T) {
},
)
}

func TestStartWithNoEnvOk(t *testing.T) {
temp, _ := ioutil.TempDir("", "convox-test")
appDir := temp + "/app"
os.Mkdir(appDir, 0777)

fmt.Println(appDir)
d1 := []byte(manifestExplicitEqual)
ioutil.WriteFile(appDir+"/docker-compose.yml", d1, 0777)

test.Runs(t,
test.ExecRun{
Command: fmt.Sprintf("convox start"),
Dir: appDir,
Env: map[string]string{"CONVOX_CONFIG": temp},
Exit: 0,
},
)
}
10 changes: 7 additions & 3 deletions test/exec.go
Expand Up @@ -27,9 +27,13 @@ func (er ExecRun) Test(t *testing.T) {

assert.Nil(t, err, "should be nil")
assert.Equal(t, er.Exit, code, "exit code should be equal")
assert.Equal(t, er.Stdout, stdout, "stdout should be equal")
assert.Contains(t, stderr, er.Stderr,
fmt.Sprintf("stderr should contain %q", stderr))
if er.Stdout != "" {
assert.Equal(t, er.Stdout, stdout, "stdout should be equal")
}
if er.Stderr != "" {
assert.Contains(t, stderr, er.Stderr,
fmt.Sprintf("stderr should contain %q", stderr))
}
}

func (er ExecRun) exec() (string, string, int, error) {
Expand Down

0 comments on commit 09d8630

Please sign in to comment.