summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-03-14 09:22:56 +0100
committerMartin Polden <mpolden@mpolden.no>2022-03-14 09:59:58 +0100
commit8c22fe956da79b46b429cccfdad09f97b9e31e82 (patch)
tree15897983c1aecafc574c8deca1fed4b81793914c /client
parent9c670d13024cb9401602abcf28a88a97e4db61a4 (diff)
Rename NextResponse -> NextResponseString
Diffstat (limited to 'client')
-rw-r--r--client/go/auth/zts/zts_test.go4
-rw-r--r--client/go/cmd/clone_list_test.go8
-rw-r--r--client/go/cmd/deploy_test.go6
-rw-r--r--client/go/cmd/document_test.go6
-rw-r--r--client/go/cmd/log_test.go6
-rw-r--r--client/go/cmd/prod_test.go4
-rw-r--r--client/go/cmd/query_test.go8
-rw-r--r--client/go/cmd/test_test.go10
-rw-r--r--client/go/cmd/version_test.go4
-rw-r--r--client/go/mock/http.go2
10 files changed, 29 insertions, 29 deletions
diff --git a/client/go/auth/zts/zts_test.go b/client/go/auth/zts/zts_test.go
index 0eec085aadb..504f29e9808 100644
--- a/client/go/auth/zts/zts_test.go
+++ b/client/go/auth/zts/zts_test.go
@@ -13,12 +13,12 @@ func TestAccessToken(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- httpClient.NextResponse(400, `{"message": "bad request"}`)
+ httpClient.NextResponseString(400, `{"message": "bad request"}`)
_, err = client.AccessToken("vespa.vespa", tls.Certificate{})
if err == nil {
t.Fatal("want error for non-ok response status")
}
- httpClient.NextResponse(200, `{"access_token": "foo bar"}`)
+ httpClient.NextResponseString(200, `{"access_token": "foo bar"}`)
token, err := client.AccessToken("vespa.vespa", tls.Certificate{})
if err != nil {
t.Fatal(err)
diff --git a/client/go/cmd/clone_list_test.go b/client/go/cmd/clone_list_test.go
index 73aa70f12f2..2ed2449af7d 100644
--- a/client/go/cmd/clone_list_test.go
+++ b/client/go/cmd/clone_list_test.go
@@ -12,10 +12,10 @@ import (
func TestListSampleApps(t *testing.T) {
c := &mock.HTTPClient{}
- c.NextResponse(200, readTestData(t, "sample-apps-contents.json"))
- c.NextResponse(200, readTestData(t, "sample-apps-news.json"))
- c.NextResponse(200, readTestData(t, "sample-apps-operations.json"))
- c.NextResponse(200, readTestData(t, "sample-apps-vespa-cloud.json"))
+ c.NextResponseString(200, readTestData(t, "sample-apps-contents.json"))
+ c.NextResponseString(200, readTestData(t, "sample-apps-news.json"))
+ c.NextResponseString(200, readTestData(t, "sample-apps-operations.json"))
+ c.NextResponseString(200, readTestData(t, "sample-apps-vespa-cloud.json"))
apps, err := listSampleApps(c)
assert.Nil(t, err)
diff --git a/client/go/cmd/deploy_test.go b/client/go/cmd/deploy_test.go
index e2d6da5399d..c46322953c0 100644
--- a/client/go/cmd/deploy_test.go
+++ b/client/go/cmd/deploy_test.go
@@ -119,7 +119,7 @@ func assertDeploy(applicationPackage string, arguments []string, t *testing.T) {
func assertPrepare(applicationPackage string, arguments []string, t *testing.T) {
client := &mock.HTTPClient{}
- client.NextResponse(200, `{"session-id":"42"}`)
+ client.NextResponseString(200, `{"session-id":"42"}`)
cli, stdout, _ := newTestCLI(t)
cli.httpClient = client
assert.Nil(t, cli.Run(arguments...))
@@ -170,7 +170,7 @@ func assertDeployRequestMade(target string, client *mock.HTTPClient, t *testing.
func assertApplicationPackageError(t *testing.T, cmd string, status int, expectedMessage string, returnBody string) {
client := &mock.HTTPClient{}
- client.NextResponse(status, returnBody)
+ client.NextResponseString(status, returnBody)
cli, _, stderr := newTestCLI(t)
cli.httpClient = client
assert.NotNil(t, cli.Run(cmd, "testdata/applications/withTarget/target/application.zip"))
@@ -181,7 +181,7 @@ func assertApplicationPackageError(t *testing.T, cmd string, status int, expecte
func assertDeployServerError(t *testing.T, status int, errorMessage string) {
client := &mock.HTTPClient{}
- client.NextResponse(status, errorMessage)
+ client.NextResponseString(status, errorMessage)
cli, _, stderr := newTestCLI(t)
cli.httpClient = client
assert.NotNil(t, cli.Run("deploy", "testdata/applications/withTarget/target/application.zip"))
diff --git a/client/go/cmd/document_test.go b/client/go/cmd/document_test.go
index 77b7d68d666..b6f3cbcf6ca 100644
--- a/client/go/cmd/document_test.go
+++ b/client/go/cmd/document_test.go
@@ -131,7 +131,7 @@ func assertDocumentGet(arguments []string, documentId string, t *testing.T) {
if err != nil {
t.Fatal(err)
}
- client.NextResponse(200, "{\"fields\":{\"foo\":\"bar\"}}")
+ client.NextResponseString(200, "{\"fields\":{\"foo\":\"bar\"}}")
cli, stdout, _ := newTestCLI(t)
cli.httpClient = client
assert.Nil(t, cli.Run(arguments...))
@@ -150,7 +150,7 @@ func assertDocumentGet(arguments []string, documentId string, t *testing.T) {
func assertDocumentError(t *testing.T, status int, errorMessage string) {
client := &mock.HTTPClient{}
- client.NextResponse(status, errorMessage)
+ client.NextResponseString(status, errorMessage)
cli, _, stderr := newTestCLI(t)
cli.httpClient = client
assert.NotNil(t, cli.Run("document", "put",
@@ -163,7 +163,7 @@ func assertDocumentError(t *testing.T, status int, errorMessage string) {
func assertDocumentServerError(t *testing.T, status int, errorMessage string) {
client := &mock.HTTPClient{}
- client.NextResponse(status, errorMessage)
+ client.NextResponseString(status, errorMessage)
cli, _, stderr := newTestCLI(t)
cli.httpClient = client
assert.NotNil(t, cli.Run("document", "put",
diff --git a/client/go/cmd/log_test.go b/client/go/cmd/log_test.go
index fb08474dd4d..d3e7b630869 100644
--- a/client/go/cmd/log_test.go
+++ b/client/go/cmd/log_test.go
@@ -12,7 +12,7 @@ import (
func TestLog(t *testing.T) {
pkgDir := mockApplicationPackage(t, false)
httpClient := &mock.HTTPClient{}
- httpClient.NextResponse(200, `1632738690.905535 host1a.dev.aws-us-east-1c 806/53 logserver-container Container.com.yahoo.container.jdisc.ConfiguredApplication info Switching to the latest deployed set of configurations and components. Application config generation: 52532`)
+ httpClient.NextResponseString(200, `1632738690.905535 host1a.dev.aws-us-east-1c 806/53 logserver-container Container.com.yahoo.container.jdisc.ConfiguredApplication info Switching to the latest deployed set of configurations and components. Application config generation: 52532`)
cli, stdout, stderr := newTestCLI(t)
cli.httpClient = httpClient
@@ -36,8 +36,8 @@ func TestLogOldClient(t *testing.T) {
pkgDir := mockApplicationPackage(t, false)
httpClient := &mock.HTTPClient{}
- httpClient.NextResponse(200, `{"minVersion": "8.0.0"}`)
- httpClient.NextResponse(200, `1632738690.905535 host1a.dev.aws-us-east-1c 806/53 logserver-container Container.com.yahoo.container.jdisc.ConfiguredApplication info Switching to the latest deployed set of configurations and components. Application config generation: 52532`)
+ httpClient.NextResponseString(200, `{"minVersion": "8.0.0"}`)
+ httpClient.NextResponseString(200, `1632738690.905535 host1a.dev.aws-us-east-1c 806/53 logserver-container Container.com.yahoo.container.jdisc.ConfiguredApplication info Switching to the latest deployed set of configurations and components. Application config generation: 52532`)
cli.httpClient = httpClient
assert.Nil(t, cli.Run("config", "set", "application", "t1.a1.i1"))
diff --git a/client/go/cmd/prod_test.go b/client/go/cmd/prod_test.go
index 06883dfcdcf..0441d334fa1 100644
--- a/client/go/cmd/prod_test.go
+++ b/client/go/cmd/prod_test.go
@@ -152,7 +152,7 @@ func TestProdSubmit(t *testing.T) {
createApplication(t, pkgDir, false)
httpClient := &mock.HTTPClient{}
- httpClient.NextResponse(200, `ok`)
+ httpClient.NextResponseString(200, `ok`)
cli, stdout, _ := newTestCLI(t, "CI=true")
cli.httpClient = httpClient
@@ -195,7 +195,7 @@ func TestProdSubmitWithJava(t *testing.T) {
createApplication(t, pkgDir, true)
httpClient := &mock.HTTPClient{}
- httpClient.NextResponse(200, `ok`)
+ httpClient.NextResponseString(200, `ok`)
cli, stdout, _ := newTestCLI(t, "CI=true")
cli.httpClient = httpClient
assert.Nil(t, cli.Run("config", "set", "application", "t1.a1.i1"))
diff --git a/client/go/cmd/query_test.go b/client/go/cmd/query_test.go
index a9348f8ddeb..ab03058d079 100644
--- a/client/go/cmd/query_test.go
+++ b/client/go/cmd/query_test.go
@@ -21,7 +21,7 @@ func TestQuery(t *testing.T) {
func TestQueryVerbose(t *testing.T) {
client := &mock.HTTPClient{}
- client.NextResponse(200, "{\"query\":\"result\"}")
+ client.NextResponseString(200, "{\"query\":\"result\"}")
cli, stdout, stderr := newTestCLI(t)
cli.httpClient = client
@@ -59,7 +59,7 @@ func TestServerError(t *testing.T) {
func assertQuery(t *testing.T, expectedQuery string, query ...string) {
client := &mock.HTTPClient{}
- client.NextResponse(200, "{\"query\":\"result\"}")
+ client.NextResponseString(200, "{\"query\":\"result\"}")
cli, stdout, _ := newTestCLI(t)
cli.httpClient = client
@@ -76,7 +76,7 @@ func assertQuery(t *testing.T, expectedQuery string, query ...string) {
func assertQueryError(t *testing.T, status int, errorMessage string) {
client := &mock.HTTPClient{}
- client.NextResponse(status, errorMessage)
+ client.NextResponseString(status, errorMessage)
cli, _, stderr := newTestCLI(t)
cli.httpClient = client
assert.NotNil(t, cli.Run("query", "yql=select from sources * where title contains 'foo'"))
@@ -88,7 +88,7 @@ func assertQueryError(t *testing.T, status int, errorMessage string) {
func assertQueryServiceError(t *testing.T, status int, errorMessage string) {
client := &mock.HTTPClient{}
- client.NextResponse(status, errorMessage)
+ client.NextResponseString(status, errorMessage)
cli, _, stderr := newTestCLI(t)
cli.httpClient = client
assert.NotNil(t, cli.Run("query", "yql=select from sources * where title contains 'foo'"))
diff --git a/client/go/cmd/test_test.go b/client/go/cmd/test_test.go
index c3538c7cb1a..b6bc6a826d8 100644
--- a/client/go/cmd/test_test.go
+++ b/client/go/cmd/test_test.go
@@ -25,7 +25,7 @@ func TestSuite(t *testing.T) {
client.NextStatus(200)
client.NextStatus(200)
for i := 0; i < 11; i++ {
- client.NextResponse(200, string(searchResponse))
+ client.NextResponseString(200, string(searchResponse))
}
expectedBytes, _ := ioutil.ReadFile("testdata/tests/expected-suite.out")
@@ -96,8 +96,8 @@ func TestSingleTest(t *testing.T) {
searchResponse, _ := ioutil.ReadFile("testdata/tests/response.json")
client.NextStatus(200)
client.NextStatus(200)
- client.NextResponse(200, string(searchResponse))
- client.NextResponse(200, string(searchResponse))
+ client.NextResponseString(200, string(searchResponse))
+ client.NextResponseString(200, string(searchResponse))
cli, stdout, stderr := newTestCLI(t)
cli.httpClient = client
@@ -136,8 +136,8 @@ func TestSingleTestWithCloudAndEndpoints(t *testing.T) {
require.Nil(t, err)
client.NextStatus(200)
client.NextStatus(200)
- client.NextResponse(200, string(searchResponse))
- client.NextResponse(200, string(searchResponse))
+ client.NextResponseString(200, string(searchResponse))
+ client.NextResponseString(200, string(searchResponse))
assert.Nil(t, cli.Run("test", "testdata/tests/system-test/test.json", "-t", "cloud", "-a", "t.a.i"))
expectedBytes, err := ioutil.ReadFile("testdata/tests/expected.out")
diff --git a/client/go/cmd/version_test.go b/client/go/cmd/version_test.go
index b78c66c9e7f..4354a2098c7 100644
--- a/client/go/cmd/version_test.go
+++ b/client/go/cmd/version_test.go
@@ -10,7 +10,7 @@ import (
func TestVersion(t *testing.T) {
c := &mock.HTTPClient{}
- c.NextResponse(200, `[{"tag_name": "v1.2.3", "published_at": "2021-09-10T12:00:00Z"}]`)
+ c.NextResponseString(200, `[{"tag_name": "v1.2.3", "published_at": "2021-09-10T12:00:00Z"}]`)
sp := &mock.Exec{}
cli, stdout, stderr := newTestCLI(t)
@@ -27,7 +27,7 @@ func TestVersion(t *testing.T) {
func TestVersionCheckHomebrew(t *testing.T) {
c := &mock.HTTPClient{}
- c.NextResponse(200, `[{"tag_name": "v1.2.3", "published_at": "2021-09-10T12:00:00Z"}]`)
+ c.NextResponseString(200, `[{"tag_name": "v1.2.3", "published_at": "2021-09-10T12:00:00Z"}]`)
sp := &mock.Exec{ProgramPath: "/usr/local/bin/vespa", CombinedOutput: "/usr/local"}
cli, stdout, stderr := newTestCLI(t)
diff --git a/client/go/mock/http.go b/client/go/mock/http.go
index f2fcf9c5960..bab9ae71e50 100644
--- a/client/go/mock/http.go
+++ b/client/go/mock/http.go
@@ -27,7 +27,7 @@ type httpResponse struct {
func (c *HTTPClient) NextStatus(status int) { c.NextResponseBytes(status, nil) }
-func (c *HTTPClient) NextResponse(status int, body string) {
+func (c *HTTPClient) NextResponseString(status int, body string) {
c.NextResponseBytes(status, []byte(body))
}