-
Notifications
You must be signed in to change notification settings - Fork 87
/
features_test.go
77 lines (69 loc) · 1.95 KB
/
features_test.go
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
68
69
70
71
72
73
74
75
76
77
package meilisearch
import (
"crypto/tls"
"testing"
"github.com/stretchr/testify/require"
)
func TestGet_ExperimentalFeatures(t *testing.T) {
sv := setup(t, "")
customSv := setup(t, "", WithCustomClientWithTLS(&tls.Config{
InsecureSkipVerify: true,
}))
tests := []struct {
name string
client ServiceManager
}{
{
name: "TestGetStats",
client: sv,
},
{
name: "TestGetStatsWithCustomClient",
client: customSv,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ef := tt.client.ExperimentalFeatures()
gotResp, err := ef.Get()
require.NoError(t, err)
require.NotNil(t, gotResp, "ExperimentalFeatures.Get() should not return nil value")
})
}
}
func TestUpdate_ExperimentalFeatures(t *testing.T) {
sv := setup(t, "")
customSv := setup(t, "", WithCustomClientWithTLS(&tls.Config{
InsecureSkipVerify: true,
}))
tests := []struct {
name string
client ServiceManager
}{
{
name: "TestUpdateStats",
client: sv,
},
{
name: "TestUpdateStatsWithCustomClient",
client: customSv,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ef := tt.client.ExperimentalFeatures()
ef.SetVectorStore(true)
ef.SetLogsRoute(true)
ef.SetMetrics(true)
ef.SetEditDocumentsByFunction(true)
ef.SetContainsFilter(true)
gotResp, err := ef.Update()
require.NoError(t, err)
require.Equal(t, true, gotResp.VectorStore, "ExperimentalFeatures.Update() should return vectorStore as true")
require.Equal(t, true, gotResp.LogsRoute, "ExperimentalFeatures.Update() should return logsRoute as true")
require.Equal(t, true, gotResp.Metrics, "ExperimentalFeatures.Update() should return metrics as true")
require.Equal(t, true, gotResp.EditDocumentsByFunction, "ExperimentalFeatures.Update() should return editDocumentsByFunction as true")
require.Equal(t, true, gotResp.ContainsFilter, "ExperimentalFeatures.Update() should return containsFilter as true")
})
}
}