-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from convox/build-error
better errors during unexpected build scenario
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/convox/rack/client" | ||
"github.com/convox/rack/test" | ||
) | ||
|
||
func TestBuildsPreventAgainstCreating(t *testing.T) { | ||
ts := testServer(t, | ||
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "creating"}}, | ||
) | ||
|
||
defer ts.Close() | ||
|
||
test.Runs(t, | ||
test.ExecRun{ | ||
Command: "convox build https://example.org --app foo", | ||
Exit: 1, | ||
Stdout: "", | ||
Stderr: "ERROR: app is still creating: foo\n", | ||
}, | ||
) | ||
} | ||
|
||
func TestBuildsCreateReturnsNoBuild(t *testing.T) { | ||
ts := testServer(t, | ||
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "running"}}, | ||
test.Http{Method: "POST", Path: "/apps/foo/builds", Body: "repo=https%3A%2F%2Fexample.org", Code: 200, Response: client.Build{}}, | ||
) | ||
|
||
defer ts.Close() | ||
|
||
test.Runs(t, | ||
test.ExecRun{ | ||
Command: "convox build https://example.org --app foo", | ||
Exit: 1, | ||
Stdout: "", | ||
Stderr: "ERROR: unable to fetch build id\n", | ||
}, | ||
) | ||
} |