1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package cmd
import (
"io/ioutil"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/vespa-engine/vespa/client/go/mock"
)
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"))
apps, err := listSampleApps(c)
assert.Nil(t, err)
expected := []string{
"album-recommendation-monitoring",
"album-recommendation-selfhosted",
"basic-search-on-gke",
"boolean-search",
"dense-passage-retrieval-with-ann",
"generic-request-processing",
"http-api-using-request-handlers-and-processors",
"incremental-search",
"model-evaluation",
"msmarco-ranking",
"multiple-bundles",
"multiple-bundles-lib",
"news/app-1-getting-started",
"news/app-2-feed-and-query",
"news/app-3-searching",
"news/app-5-recommendation",
"news/app-6-recommendation-with-searchers",
"news/app-7-parent-child",
"operations/multinode",
"part-purchases-demo",
"secure-vespa-with-mtls",
"semantic-qa-retrieval",
"tensor-playground",
"text-search",
"transformers",
"use-case-shopping",
"vespa-chinese-linguistics",
"vespa-cloud/album-recommendation",
"vespa-cloud/album-recommendation-docproc",
"vespa-cloud/album-recommendation-prod",
"vespa-cloud/album-recommendation-searcher",
"vespa-cloud/cord-19-search",
"vespa-cloud/joins",
"vespa-cloud/vespa-documentation-search",
}
assert.Equal(t, expected, apps)
}
func readTestData(t *testing.T, name string) string {
contents, err := ioutil.ReadFile(filepath.Join("testdata", name))
if err != nil {
t.Fatal(err)
}
return string(contents)
}
|