summaryrefslogtreecommitdiffstats
path: root/client/go/cmd/deploy_test.go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-09-28 15:17:50 +0200
committerMartin Polden <mpolden@mpolden.no>2021-09-29 10:27:39 +0200
commit16977143c48117d254c548e7f94968976f54a72c (patch)
tree09d044ebd82090bc2fc391afbe5c062dca3b37e5 /client/go/cmd/deploy_test.go
parent728dfbe2c8dc0b387b5e6671ff0fe4e4cfbed2f8 (diff)
Print errors to stderr
Diffstat (limited to 'client/go/cmd/deploy_test.go')
-rw-r--r--client/go/cmd/deploy_test.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/client/go/cmd/deploy_test.go b/client/go/cmd/deploy_test.go
index 9614806b968..5bb45e70fad 100644
--- a/client/go/cmd/deploy_test.go
+++ b/client/go/cmd/deploy_test.go
@@ -61,9 +61,10 @@ func TestDeployApplicationDirectoryWithPomAndTarget(t *testing.T) {
func TestDeployApplicationDirectoryWithPomAndEmptyTarget(t *testing.T) {
client := &mockHttpClient{}
+ _, outErr := execute(command{args: []string{"deploy", "testdata/applications/withEmptyTarget"}}, t, client)
assert.Equal(t,
"Error: pom.xml exists but no target/application.zip. Run mvn package first\n",
- executeCommand(t, client, []string{"deploy", "testdata/applications/withEmptyTarget"}, []string{}))
+ outErr)
}
func TestDeployApplicationPackageErrorWithUnexpectedNonJson(t *testing.T) {
@@ -85,7 +86,7 @@ func TestDeployApplicationPackageErrorWithExpectedFormat(t *testing.T) {
"Invalid XML, error in services.xml:\nelement \"nosuch\" not allowed here",
`{
"error-code": "INVALID_APPLICATION_PACKAGE",
- "message": "Invalid XML, error in services.xml: element \"nosuch\" not allowed here\n"
+ "message": "Invalid XML, error in services.xml: element \"nosuch\" not allowed here"
}`)
}
@@ -94,7 +95,7 @@ func TestPrepareApplicationPackageErrorWithExpectedFormat(t *testing.T) {
"Invalid XML, error in services.xml:\nelement \"nosuch\" not allowed here",
`{
"error-code": "INVALID_APPLICATION_PACKAGE",
- "message": "Invalid XML, error in services.xml: element \"nosuch\" not allowed here\n"
+ "message": "Invalid XML, error in services.xml: element \"nosuch\" not allowed here"
}`)
}
@@ -158,18 +159,20 @@ func assertDeployRequestMade(target string, client *mockHttpClient, t *testing.T
assertPackageUpload(-1, target+"/application/v2/tenant/default/prepareandactivate", client, t)
}
-func assertApplicationPackageError(t *testing.T, command string, status int, expectedMessage string, returnBody string) {
+func assertApplicationPackageError(t *testing.T, cmd string, status int, expectedMessage string, returnBody string) {
client := &mockHttpClient{}
client.NextResponse(status, returnBody)
+ _, outErr := execute(command{args: []string{cmd, "testdata/applications/withTarget/target/application.zip"}}, t, client)
assert.Equal(t,
"Error: Invalid application package (Status "+strconv.Itoa(status)+")\n\n"+expectedMessage+"\n",
- executeCommand(t, client, []string{command, "testdata/applications/withTarget/target/application.zip"}, []string{}))
+ outErr)
}
func assertDeployServerError(t *testing.T, status int, errorMessage string) {
client := &mockHttpClient{}
client.NextResponse(status, errorMessage)
+ _, outErr := execute(command{args: []string{"deploy", "testdata/applications/withTarget/target/application.zip"}}, t, client)
assert.Equal(t,
"Error: Error from deploy service at 127.0.0.1:19071 (Status "+strconv.Itoa(status)+"):\n"+errorMessage+"\n",
- executeCommand(t, client, []string{"deploy", "testdata/applications/withTarget/target/application.zip"}, []string{}))
+ outErr)
}