aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/cmd/test_test.go
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-12-06 13:53:35 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-12-06 13:53:35 +0100
commitec530033f1e144b48eccc6c935b2e909d7abaf12 (patch)
treea37da550bb1d90946c64d29fa0cb19720d0f340a /client/go/cmd/test_test.go
parent2b5ad41564dc9a0e3d41b97d70ed465b20bd0461 (diff)
Validate file references
Diffstat (limited to 'client/go/cmd/test_test.go')
-rw-r--r--client/go/cmd/test_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/client/go/cmd/test_test.go b/client/go/cmd/test_test.go
index 10a62e0495d..6649353df77 100644
--- a/client/go/cmd/test_test.go
+++ b/client/go/cmd/test_test.go
@@ -45,6 +45,15 @@ func TestSuite(t *testing.T) {
assert.Equal(t, "", errBytes)
}
+func TestIllegalFileReference(t *testing.T) {
+ client := &mockHttpClient{}
+ client.NextStatus(200)
+ client.NextStatus(200)
+ _, errBytes := execute(command{args: []string{"test", "testdata/tests/production-test/illegal-reference.json"}}, t, client)
+ assertRequests([]*http.Request{createRequest("GET", "http://127.0.0.1:8080/search/", "{}")}, client, t)
+ assert.Equal(t, "\nError: path may not point outside src/test/application, but 'foo/../../../../this-is-not-ok.json' does\nHint: Error in Step 2\nHint: See https://cloud.vespa.ai/en/reference/testing\n", errBytes)
+}
+
func TestProductionTest(t *testing.T) {
client := &mockHttpClient{}
client.NextStatus(200)