@@ -13,7 +13,6 @@ import (
13
13
"github.com/appscode/searchlight/pkg/icinga"
14
14
"github.com/appscode/searchlight/pkg/operator"
15
15
"github.com/appscode/searchlight/test/e2e/framework"
16
- . "github.com/appscode/searchlight/test/e2e/matcher"
17
16
. "github.com/onsi/ginkgo"
18
17
"github.com/onsi/ginkgo/reporters"
19
18
. "github.com/onsi/gomega"
@@ -26,15 +25,15 @@ import (
26
25
)
27
26
28
27
var (
29
- provider string
30
- storageClass string
31
- providedIcinga string
28
+ provider string
29
+ storageClass string
30
+ searchlightService string
32
31
)
33
32
34
33
func init () {
35
34
flag .StringVar (& provider , "provider" , "minikube" , "Kubernetes cloud provider" )
36
35
flag .StringVar (& storageClass , "storageclass" , "" , "Kubernetes StorageClass name" )
37
- flag .StringVar (& providedIcinga , "provided-icinga " , "" , "Running Icinga reference" )
36
+ flag .StringVar (& searchlightService , "searchlight-service " , "" , "Running searchlight reference" )
38
37
}
39
38
40
39
const (
@@ -56,6 +55,9 @@ func TestE2e(t *testing.T) {
56
55
}
57
56
58
57
var _ = BeforeSuite (func () {
58
+
59
+ Expect (searchlightService ).ShouldNot (BeEmpty ())
60
+
59
61
// Kubernetes config
60
62
kubeconfigPath := filepath .Join (homedir .HomeDir (), ".kube/config" )
61
63
By ("Using kubeconfig from " + kubeconfigPath )
@@ -75,28 +77,13 @@ var _ = BeforeSuite(func() {
75
77
err = root .CreateNamespace ()
76
78
Expect (err ).NotTo (HaveOccurred ())
77
79
78
- var slService * core.Service
79
- if providedIcinga == "" {
80
- // Create Searchlight deployment
81
- slDeployment := root .Invoke ().DeploymentSearchlight ()
82
- err = root .CreateDeployment (slDeployment )
83
- Expect (err ).NotTo (HaveOccurred ())
84
- By ("Waiting for Running pods" )
85
- root .EventuallyDeployment (slDeployment .ObjectMeta ).Should (HaveRunningPods (* slDeployment .Spec .Replicas ))
86
- // Create Searchlight service
87
- slService = root .Invoke ().ServiceSearchlight ()
88
- err = root .CreateService (slService )
89
- Expect (err ).NotTo (HaveOccurred ())
90
- root .EventuallyServiceLoadBalancer (slService .ObjectMeta , "icinga" ).Should (BeTrue ())
91
-
92
- } else {
93
- parts := strings .Split (providedIcinga , "@" )
94
- om := metav1.ObjectMeta {
95
- Name : parts [0 ],
96
- Namespace : parts [1 ],
97
- }
98
- slService = & core.Service {ObjectMeta : om }
80
+ parts := strings .Split (searchlightService , "@" )
81
+ Expect (len (parts )).Should (BeIdenticalTo (2 ))
82
+ om := metav1.ObjectMeta {
83
+ Name : parts [0 ],
84
+ Namespace : parts [1 ],
99
85
}
86
+ slService := & core.Service {ObjectMeta : om }
100
87
101
88
// Get Icinga Ingress Hostname
102
89
endpoint , err := root .GetServiceEndpoint (slService .ObjectMeta , "icinga" )
@@ -109,7 +96,8 @@ var _ = BeforeSuite(func() {
109
96
}
110
97
111
98
cfg .BasicAuth .Username = ICINGA_API_USER
112
- cfg .BasicAuth .Password = ICINGA_API_PASSWORD
99
+ cfg .BasicAuth .Password , err = root .Invoke ().GetIcingaApiPassword (om )
100
+ Expect (err ).NotTo (HaveOccurred ())
113
101
114
102
// Icinga Client
115
103
icingaClient := icinga .NewClient (* cfg )
@@ -123,21 +111,6 @@ var _ = BeforeSuite(func() {
123
111
fmt .Println ("Login password: " , ICINGA_WEB_UI_PASSWORD )
124
112
fmt .Println ()
125
113
126
- opc := & operator.OperatorConfig {
127
- Config : operator.Config {
128
- MaxNumRequeues : 3 ,
129
- NumThreads : 3 ,
130
- Verbosity : "6" ,
131
- },
132
- KubeClient : kubeClient ,
133
- CRDClient : apiExtKubeClient ,
134
- ExtClient : extClient ,
135
- IcingaClient : icingaClient ,
136
- }
137
- // Controller
138
- op , err = opc .New ()
139
- Expect (err ).NotTo (HaveOccurred ())
140
- go op .RunWatchers (nil )
141
114
})
142
115
143
116
var _ = AfterSuite (func () {
0 commit comments