-
Notifications
You must be signed in to change notification settings - Fork 73
/
config_repository_test.go
54 lines (49 loc) · 1.23 KB
/
config_repository_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
package config_test
import (
"database/sql"
"testing"
"github.com/gorilla/mux"
"github.com/kubeshop/tracetest/server/config"
"github.com/kubeshop/tracetest/server/resourcemanager"
rmtests "github.com/kubeshop/tracetest/server/resourcemanager/testutil"
)
func TestConfigResource(t *testing.T) {
rmtests.TestResourceType(t, rmtests.ResourceTypeTest{
ResourceTypeSingular: config.ResourceName,
ResourceTypePlural: config.ResourceNamePlural,
RegisterManagerFn: func(router *mux.Router, db *sql.DB) resourcemanager.Manager {
configRepo := config.NewRepository(db)
manager := resourcemanager.New[config.Config](
config.ResourceName,
config.ResourceNamePlural,
configRepo,
resourcemanager.DisableDelete(),
)
manager.RegisterRoutes(router)
return manager
},
SampleJSON: `{
"type": "Config",
"spec": {
"id": "current",
"name": "Config",
"analyticsEnabled": true
}
}`,
SampleJSONUpdated: `{
"type": "Config",
"spec": {
"id": "current",
"name": "Config",
"analyticsEnabled": false
}
}`,
},
rmtests.ExcludeOperations(
rmtests.OperationGetNotFound,
rmtests.OperationUpdateNotFound,
rmtests.OperationListSortSuccess,
rmtests.OperationListNoResults,
),
)
}