@@ -4,6 +4,10 @@ import (
4
4
"os"
5
5
6
6
v1 "github.com/flanksource/canary-checker/api/v1"
7
+ "github.com/flanksource/canary-checker/pkg/db"
8
+ "github.com/flanksource/canary-checker/pkg/utils"
9
+ "github.com/flanksource/duty/models"
10
+ "github.com/flanksource/duty/types"
7
11
ginkgo "github.com/onsi/ginkgo/v2"
8
12
. "github.com/onsi/gomega"
9
13
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -42,16 +46,30 @@ var _ = ginkgo.Describe("Test topology run", ginkgo.Ordered, func() {
42
46
ginkgo .Fail ("Error converting yaml to v1.Topology:" + err .Error ())
43
47
}
44
48
49
+ ci := models.ConfigItem {
50
+ Name : utils .Ptr ("config-item" ),
51
+ Tags : & types.JSONStringMap {
52
+ "tag-1" : "a" ,
53
+ "tag-2" : "b" ,
54
+ },
55
+ Config : utils .Ptr (`{"spec": {"container": {"name": "hello", "version": "v3"}}}` ),
56
+ Type : utils .Ptr ("Config::Dummy" ),
57
+ ConfigClass : "Dummy" ,
58
+ }
59
+
60
+ err = db .Gorm .Create (& ci ).Error
61
+ Expect (err ).To (BeNil ())
62
+
45
63
rootComponent := Run (opts , t )
46
64
Expect (len (rootComponent [0 ].Components )).To (Equal (3 ))
47
65
48
66
componentA := rootComponent [0 ].Components [0 ]
49
67
componentB := rootComponent [0 ].Components [1 ]
50
68
componentC := rootComponent [0 ].Components [2 ]
51
69
52
- Expect (string (componentA .Properties .AsJSON ())).To (MatchJSON (`[{"name":"error_percentage","value":1,"min":0,"max":100},{"name":"owner","text":"team-a"},{"name":"company","text":"Acme"},{"name":"location","text":"Mars"},{"name":"key","text":"value"}]` ))
53
- Expect (string (componentB .Properties .AsJSON ())).To (MatchJSON (`[{"name":"error_percentage","value":10,"min":0,"max":100},{"name":"owner","text":"team-b"},{"name":"company","text":"Acme"},{"name":"location","text":"Mars"},{"name":"key","text":"value"}]` ))
54
- Expect (string (componentC .Properties .AsJSON ())).To (MatchJSON (`[{"name":"error_percentage","value":50,"min":0,"max":100},{"name":"owner","text":"team-b"},{"name":"company","text":"Acme"},{"name":"location","text":"Mars"},{"name":"key","text":"value"}]` ))
70
+ Expect (string (componentA .Properties .AsJSON ())).To (MatchJSON (`[{"name":"error_percentage","value":1,"min":0,"max":100},{"name":"owner","text":"team-a"},{"name":"company","text":"Acme"},{"name":"location","text":"Mars"},{"name":"key","text":"value"},{"name":"config-key","text":"v3"} ]` ))
71
+ Expect (string (componentB .Properties .AsJSON ())).To (MatchJSON (`[{"name":"error_percentage","value":10,"min":0,"max":100},{"name":"owner","text":"team-b"},{"name":"company","text":"Acme"},{"name":"location","text":"Mars"},{"name":"key","text":"value"},{"name":"config-key","text":"v3"} ]` ))
72
+ Expect (string (componentC .Properties .AsJSON ())).To (MatchJSON (`[{"name":"error_percentage","value":50,"min":0,"max":100},{"name":"owner","text":"team-b"},{"name":"company","text":"Acme"},{"name":"location","text":"Mars"},{"name":"key","text":"value"},{"name":"config-key","text":"v3"} ]` ))
55
73
})
56
74
57
75
ginkgo .It ("should create component with forEach functionality" , func () {
0 commit comments