...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package watcher
17
18 import (
19 . "github.com/onsi/ginkgo"
20 . "github.com/onsi/gomega"
21 )
22
23 var _ = Describe("webhook config watcher", func() {
24 Context("Test webhook config", func() {
25 It("should return NewConfig", func() {
26 config := NewConfig()
27 Expect(config.TemplateNamespace).To(Equal(""))
28 Expect(config.TargetNamespace).To(Equal(""))
29 Expect(config.ConfigLabels).To(Equal(map[string]string{}))
30 Expect(config.TemplateLabels).To(Equal(map[string]string{}))
31 })
32
33 It("verift the parameter", func() {
34 config := NewConfig()
35 Expect(config.Verify()).Should(HaveOccurred())
36
37 config.TemplateLabels = make(map[string]string)
38 config.TemplateLabels["bar"] = "foo"
39 Expect(config.Verify()).Should(HaveOccurred())
40
41 config.ConfigLabels = make(map[string]string)
42 config.ConfigLabels["bar"] = "foo"
43 Expect(config.Verify()).ShouldNot(HaveOccurred())
44 })
45
46 })
47 })
48