aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorHÃ¥kon Hallingstad <hakon@verizonmedia.com>2021-11-26 10:23:13 +0100
committerGitHub <noreply@github.com>2021-11-26 10:23:13 +0100
commit514575491c501a17034118b1b0db1583f77f8fbe (patch)
treee949c55cc77e5fc80db1963fda9fb9c22ef31e66 /client
parent032e60c9f6a7eda191b31c2284a831892a95a6d9 (diff)
parent0b6ddbe050c8e20429ed02db72609001bfea82ae (diff)
Merge pull request #20233 from vespa-engine/jonmv/use-basename-as-default-test-name
Use test file basename as default name
Diffstat (limited to 'client')
-rw-r--r--client/go/cmd/test.go8
-rw-r--r--client/go/cmd/test_test.go2
-rw-r--r--client/go/cmd/testdata/tests/expected-suite.out32
-rw-r--r--client/go/cmd/testdata/tests/expected.out2
4 files changed, 24 insertions, 20 deletions
diff --git a/client/go/cmd/test.go b/client/go/cmd/test.go
index 53cf2f6b6af..d6fdc9d2e41 100644
--- a/client/go/cmd/test.go
+++ b/client/go/cmd/test.go
@@ -57,7 +57,11 @@ $ vespa test src/test/application/tests/system-test/feed-and-query.json`,
fmt.Fprintf(stdout, "Failed to find any tests at %v\n", testPath)
exitFunc(3)
} else {
- fmt.Fprintf(stdout, "\n%d tests completed successfully\n", count)
+ plural := "s"
+ if count == 1 {
+ plural = ""
+ }
+ fmt.Fprintf(stdout, "\n%d test%s completed successfully\n", count, plural)
}
},
}
@@ -111,7 +115,7 @@ func runTest(testPath string, target vespa.Target) string {
testName := test.Name
if test.Name == "" {
- testName = testPath
+ testName = filepath.Base(testPath)
}
fmt.Fprintf(stdout, "Running %s:", testName)
diff --git a/client/go/cmd/test_test.go b/client/go/cmd/test_test.go
index 598f550359e..fe04e3a704a 100644
--- a/client/go/cmd/test_test.go
+++ b/client/go/cmd/test_test.go
@@ -45,7 +45,7 @@ func TestProductionTest(t *testing.T) {
client := &mockHttpClient{}
client.NextStatus(200)
outBytes, errBytes := execute(command{args: []string{"test", "testdata/tests/production-test/external.json"}}, t, client)
- assert.Equal(t, "Running testdata/tests/production-test/external.json: . OK\n\n1 tests completed successfully\n", outBytes)
+ assert.Equal(t, "Running external.json: . OK\n\n1 test completed successfully\n", outBytes)
assert.Equal(t, "", errBytes)
assertRequests([]*http.Request{createRequest("GET", "https://my.service:123/path?query=wohoo", "")}, client, t)
}
diff --git a/client/go/cmd/testdata/tests/expected-suite.out b/client/go/cmd/testdata/tests/expected-suite.out
index f214f3cf160..bef3d678957 100644
--- a/client/go/cmd/testdata/tests/expected-suite.out
+++ b/client/go/cmd/testdata/tests/expected-suite.out
@@ -1,5 +1,5 @@
Running my test: .... OK
-Running testdata/tests/system-test/wrong-bool-value.json: Failed step 1:
+Running wrong-bool-value.json: Failed step 1:
Unexpected value at /root/coverage/full: true
Expected: false
Actual response:
@@ -38,7 +38,7 @@ Actual response:
}
}
-Running testdata/tests/system-test/wrong-element-count.json: Failed step 1:
+Running wrong-element-count.json: Failed step 1:
Unexpected number of elements at /root/children: 1
Expected: 0
Actual response:
@@ -77,7 +77,7 @@ Actual response:
}
}
-Running testdata/tests/system-test/wrong-field-name.json: Failed step 1:
+Running wrong-field-name.json: Failed step 1:
Missing expected field at /root/fields/totalCountDracula
Actual response:
{
@@ -115,7 +115,7 @@ Actual response:
}
}
-Running testdata/tests/system-test/wrong-float-value.json: Failed step 1:
+Running wrong-float-value.json: Failed step 1:
Unexpected value at /root/children/0/relevance: 0.38186238359951247
Expected: 0.381862373599
Actual response:
@@ -154,7 +154,7 @@ Actual response:
}
}
-Running testdata/tests/system-test/wrong-int-value.json: Failed step 1:
+Running wrong-int-value.json: Failed step 1:
Unexpected value at /root/fields/totalCount: 1
Expected: 2
Actual response:
@@ -193,7 +193,7 @@ Actual response:
}
}
-Running testdata/tests/system-test/wrong-null-value.json: Failed step 1:
+Running wrong-null-value.json: Failed step 1:
Missing expected field at /boot
Actual response:
{
@@ -231,7 +231,7 @@ Actual response:
}
}
-Running testdata/tests/system-test/wrong-string-value.json: Failed step 1:
+Running wrong-string-value.json: Failed step 1:
Unexpected value at /root/children/0/fields/artist: "Foo Fighters"
Expected: "Boo Fighters"
Actual response:
@@ -270,7 +270,7 @@ Actual response:
}
}
-Running testdata/tests/system-test/wrong-type.json: Failed step 1:
+Running wrong-type.json: Failed step 1:
Unexpected type at /root/fields/totalCount: 1
Expected: "1"
Actual response:
@@ -310,11 +310,11 @@ Actual response:
}
Failed 8 of 9 tests:
-testdata/tests/system-test/wrong-bool-value.json: step 1: Unexpected value at /root/coverage/full: true
-testdata/tests/system-test/wrong-element-count.json: step 1: Unexpected number of elements at /root/children: 1
-testdata/tests/system-test/wrong-field-name.json: step 1: Missing expected field at /root/fields/totalCountDracula
-testdata/tests/system-test/wrong-float-value.json: step 1: Unexpected value at /root/children/0/relevance: 0.38186238359951247
-testdata/tests/system-test/wrong-int-value.json: step 1: Unexpected value at /root/fields/totalCount: 1
-testdata/tests/system-test/wrong-null-value.json: step 1: Missing expected field at /boot
-testdata/tests/system-test/wrong-string-value.json: step 1: Unexpected value at /root/children/0/fields/artist: "Foo Fighters"
-testdata/tests/system-test/wrong-type.json: step 1: Unexpected type at /root/fields/totalCount: 1
+wrong-bool-value.json: step 1: Unexpected value at /root/coverage/full: true
+wrong-element-count.json: step 1: Unexpected number of elements at /root/children: 1
+wrong-field-name.json: step 1: Missing expected field at /root/fields/totalCountDracula
+wrong-float-value.json: step 1: Unexpected value at /root/children/0/relevance: 0.38186238359951247
+wrong-int-value.json: step 1: Unexpected value at /root/fields/totalCount: 1
+wrong-null-value.json: step 1: Missing expected field at /boot
+wrong-string-value.json: step 1: Unexpected value at /root/children/0/fields/artist: "Foo Fighters"
+wrong-type.json: step 1: Unexpected type at /root/fields/totalCount: 1
diff --git a/client/go/cmd/testdata/tests/expected.out b/client/go/cmd/testdata/tests/expected.out
index b41f001cd25..d144dbe2cfa 100644
--- a/client/go/cmd/testdata/tests/expected.out
+++ b/client/go/cmd/testdata/tests/expected.out
@@ -1,3 +1,3 @@
Running my test: .... OK
-1 tests completed successfully
+1 test completed successfully