@@ -35,8 +35,8 @@ import (
35
35
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
36
36
imageutils "k8s.io/kubernetes/test/utils/image"
37
37
38
- . "github.com/onsi/ginkgo"
39
- . "github.com/onsi/gomega"
38
+ "github.com/onsi/ginkgo"
39
+ "github.com/onsi/gomega"
40
40
)
41
41
42
42
type dnsTestCommon struct {
@@ -62,14 +62,14 @@ func newDNSTestCommon() dnsTestCommon {
62
62
}
63
63
64
64
func (t * dnsTestCommon ) init () {
65
- By ("Finding a DNS pod" )
65
+ ginkgo . By ("Finding a DNS pod" )
66
66
label := labels .SelectorFromSet (labels .Set (map [string ]string {"k8s-app" : "kube-dns" }))
67
67
options := metav1.ListOptions {LabelSelector : label .String ()}
68
68
69
69
namespace := "kube-system"
70
70
pods , err := t .f .ClientSet .CoreV1 ().Pods (namespace ).List (options )
71
- Expect (err ).NotTo (HaveOccurred (), "failed to list pods in namespace: %s" , namespace )
72
- Expect (len (pods .Items )).Should (BeNumerically (">=" , 1 ))
71
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to list pods in namespace: %s" , namespace )
72
+ gomega . Expect (len (pods .Items )).Should (gomega . BeNumerically (">=" , 1 ))
73
73
74
74
t .dnsPod = & pods .Items [0 ]
75
75
e2elog .Logf ("Using DNS pod: %v" , t .dnsPod .Name )
@@ -157,23 +157,23 @@ func (t *dnsTestCommon) setConfigMap(cm *v1.ConfigMap) {
157
157
}.AsSelector ().String (),
158
158
}
159
159
cmList , err := t .c .CoreV1 ().ConfigMaps (t .ns ).List (options )
160
- Expect (err ).NotTo (HaveOccurred (), "failed to list ConfigMaps in namespace: %s" , t .ns )
160
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to list ConfigMaps in namespace: %s" , t .ns )
161
161
162
162
if len (cmList .Items ) == 0 {
163
- By (fmt .Sprintf ("Creating the ConfigMap (%s:%s) %+v" , t .ns , t .name , * cm ))
163
+ ginkgo . By (fmt .Sprintf ("Creating the ConfigMap (%s:%s) %+v" , t .ns , t .name , * cm ))
164
164
_ , err := t .c .CoreV1 ().ConfigMaps (t .ns ).Create (cm )
165
- Expect (err ).NotTo (HaveOccurred (), "failed to create ConfigMap (%s:%s) %+v" , t .ns , t .name , * cm )
165
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to create ConfigMap (%s:%s) %+v" , t .ns , t .name , * cm )
166
166
} else {
167
- By (fmt .Sprintf ("Updating the ConfigMap (%s:%s) to %+v" , t .ns , t .name , * cm ))
167
+ ginkgo . By (fmt .Sprintf ("Updating the ConfigMap (%s:%s) to %+v" , t .ns , t .name , * cm ))
168
168
_ , err := t .c .CoreV1 ().ConfigMaps (t .ns ).Update (cm )
169
- Expect (err ).NotTo (HaveOccurred (), "failed to update ConfigMap (%s:%s) to %+v" , t .ns , t .name , * cm )
169
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to update ConfigMap (%s:%s) to %+v" , t .ns , t .name , * cm )
170
170
}
171
171
}
172
172
173
173
func (t * dnsTestCommon ) fetchDNSConfigMapData () map [string ]string {
174
174
if t .name == "coredns" {
175
175
pcm , err := t .c .CoreV1 ().ConfigMaps (metav1 .NamespaceSystem ).Get (t .name , metav1.GetOptions {})
176
- Expect (err ).NotTo (HaveOccurred (), "failed to get DNS ConfigMap: %s" , t .name )
176
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to get DNS ConfigMap: %s" , t .name )
177
177
return pcm .Data
178
178
}
179
179
return nil
@@ -189,10 +189,10 @@ func (t *dnsTestCommon) restoreDNSConfigMap(configMapData map[string]string) {
189
189
}
190
190
191
191
func (t * dnsTestCommon ) deleteConfigMap () {
192
- By (fmt .Sprintf ("Deleting the ConfigMap (%s:%s)" , t .ns , t .name ))
192
+ ginkgo . By (fmt .Sprintf ("Deleting the ConfigMap (%s:%s)" , t .ns , t .name ))
193
193
t .cm = nil
194
194
err := t .c .CoreV1 ().ConfigMaps (t .ns ).Delete (t .name , nil )
195
- Expect (err ).NotTo (HaveOccurred (), "failed to delete config map: %s" , t .name )
195
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to delete config map: %s" , t .name )
196
196
}
197
197
198
198
func (t * dnsTestCommon ) createUtilPodLabel (baseName string ) {
@@ -224,9 +224,9 @@ func (t *dnsTestCommon) createUtilPodLabel(baseName string) {
224
224
225
225
var err error
226
226
t .utilPod , err = t .c .CoreV1 ().Pods (t .f .Namespace .Name ).Create (t .utilPod )
227
- Expect (err ).NotTo (HaveOccurred (), "failed to create pod: %v" , t .utilPod )
227
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to create pod: %v" , t .utilPod )
228
228
e2elog .Logf ("Created pod %v" , t .utilPod )
229
- Expect (t .f .WaitForPodRunning (t .utilPod .Name )).NotTo (HaveOccurred (), "pod failed to start running: %v" , t .utilPod )
229
+ gomega . Expect (t .f .WaitForPodRunning (t .utilPod .Name )).NotTo (gomega . HaveOccurred (), "pod failed to start running: %v" , t .utilPod )
230
230
231
231
t .utilService = & v1.Service {
232
232
TypeMeta : metav1.TypeMeta {
@@ -249,7 +249,7 @@ func (t *dnsTestCommon) createUtilPodLabel(baseName string) {
249
249
}
250
250
251
251
t .utilService , err = t .c .CoreV1 ().Services (t .f .Namespace .Name ).Create (t .utilService )
252
- Expect (err ).NotTo (HaveOccurred (), "failed to create service: %s/%s" , t .f .Namespace .Name , t .utilService .ObjectMeta .Name )
252
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to create service: %s/%s" , t .f .Namespace .Name , t .utilService .ObjectMeta .Name )
253
253
e2elog .Logf ("Created service %v" , t .utilService )
254
254
}
255
255
@@ -272,7 +272,7 @@ func (t *dnsTestCommon) deleteCoreDNSPods() {
272
272
273
273
for _ , pod := range pods .Items {
274
274
err = podClient .Delete (pod .Name , metav1 .NewDeleteOptions (0 ))
275
- Expect (err ).NotTo (HaveOccurred (), "failed to delete pod: %s" , pod .Name )
275
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to delete pod: %s" , pod .Name )
276
276
}
277
277
}
278
278
@@ -315,13 +315,13 @@ func (t *dnsTestCommon) createDNSPodFromObj(pod *v1.Pod) {
315
315
316
316
var err error
317
317
t .dnsServerPod , err = t .c .CoreV1 ().Pods (t .f .Namespace .Name ).Create (t .dnsServerPod )
318
- Expect (err ).NotTo (HaveOccurred (), "failed to create pod: %v" , t .dnsServerPod )
318
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to create pod: %v" , t .dnsServerPod )
319
319
e2elog .Logf ("Created pod %v" , t .dnsServerPod )
320
- Expect (t .f .WaitForPodRunning (t .dnsServerPod .Name )).NotTo (HaveOccurred (), "pod failed to start running: %v" , t .dnsServerPod )
320
+ gomega . Expect (t .f .WaitForPodRunning (t .dnsServerPod .Name )).NotTo (gomega . HaveOccurred (), "pod failed to start running: %v" , t .dnsServerPod )
321
321
322
322
t .dnsServerPod , err = t .c .CoreV1 ().Pods (t .f .Namespace .Name ).Get (
323
323
t .dnsServerPod .Name , metav1.GetOptions {})
324
- Expect (err ).NotTo (HaveOccurred (), "failed to get pod: %s" , t .dnsServerPod .Name )
324
+ gomega . Expect (err ).NotTo (gomega . HaveOccurred (), "failed to get pod: %s" , t .dnsServerPod .Name )
325
325
}
326
326
327
327
func (t * dnsTestCommon ) createDNSServer (aRecords map [string ]string ) {
@@ -539,30 +539,30 @@ func assertFilesContain(fileNames []string, fileDir string, pod *v1.Pod, client
539
539
e2elog .Logf ("Lookups using %s/%s failed for: %v\n " , pod .Namespace , pod .Name , failed )
540
540
return false , nil
541
541
}))
542
- Expect (len (failed )).To (Equal (0 ))
542
+ gomega . Expect (len (failed )).To (gomega . Equal (0 ))
543
543
}
544
544
545
545
func validateDNSResults (f * framework.Framework , pod * v1.Pod , fileNames []string ) {
546
- By ("submitting the pod to kubernetes" )
546
+ ginkgo . By ("submitting the pod to kubernetes" )
547
547
podClient := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name )
548
548
defer func () {
549
- By ("deleting the pod" )
550
- defer GinkgoRecover ()
549
+ ginkgo . By ("deleting the pod" )
550
+ defer ginkgo . GinkgoRecover ()
551
551
podClient .Delete (pod .Name , metav1 .NewDeleteOptions (0 ))
552
552
}()
553
553
if _ , err := podClient .Create (pod ); err != nil {
554
- framework .Failf ("Failed to create pod %s/%s: %v" , pod .Namespace , pod .Name , err )
554
+ framework .Failf ("ginkgo. Failed to create pod %s/%s: %v" , pod .Namespace , pod .Name , err )
555
555
}
556
556
557
557
framework .ExpectNoError (f .WaitForPodRunning (pod .Name ))
558
558
559
- By ("retrieving the pod" )
559
+ ginkgo . By ("retrieving the pod" )
560
560
pod , err := podClient .Get (pod .Name , metav1.GetOptions {})
561
561
if err != nil {
562
- framework .Failf ("Failed to get pod %s/%s: %v" , pod .Namespace , pod .Name , err )
562
+ framework .Failf ("ginkgo. Failed to get pod %s/%s: %v" , pod .Namespace , pod .Name , err )
563
563
}
564
564
// Try to find results for each expected name.
565
- By ("looking for the results for each expected name from probers" )
565
+ ginkgo . By ("looking for the results for each expected name from probers" )
566
566
assertFilesExist (fileNames , "results" , pod , f .ClientSet )
567
567
568
568
// TODO: probe from the host, too.
@@ -571,26 +571,26 @@ func validateDNSResults(f *framework.Framework, pod *v1.Pod, fileNames []string)
571
571
}
572
572
573
573
func validateTargetedProbeOutput (f * framework.Framework , pod * v1.Pod , fileNames []string , value string ) {
574
- By ("submitting the pod to kubernetes" )
574
+ ginkgo . By ("submitting the pod to kubernetes" )
575
575
podClient := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name )
576
576
defer func () {
577
- By ("deleting the pod" )
578
- defer GinkgoRecover ()
577
+ ginkgo . By ("deleting the pod" )
578
+ defer ginkgo . GinkgoRecover ()
579
579
podClient .Delete (pod .Name , metav1 .NewDeleteOptions (0 ))
580
580
}()
581
581
if _ , err := podClient .Create (pod ); err != nil {
582
- framework .Failf ("Failed to create pod %s/%s: %v" , pod .Namespace , pod .Name , err )
582
+ framework .Failf ("ginkgo. Failed to create pod %s/%s: %v" , pod .Namespace , pod .Name , err )
583
583
}
584
584
585
585
framework .ExpectNoError (f .WaitForPodRunning (pod .Name ))
586
586
587
- By ("retrieving the pod" )
587
+ ginkgo . By ("retrieving the pod" )
588
588
pod , err := podClient .Get (pod .Name , metav1.GetOptions {})
589
589
if err != nil {
590
- framework .Failf ("Failed to get pod %s/%s: %v" , pod .Namespace , pod .Name , err )
590
+ framework .Failf ("ginkgo. Failed to get pod %s/%s: %v" , pod .Namespace , pod .Name , err )
591
591
}
592
592
// Try to find the expected value for each expected name.
593
- By ("looking for the results for each expected name from probers" )
593
+ ginkgo . By ("looking for the results for each expected name from probers" )
594
594
assertFilesContain (fileNames , "results" , pod , f .ClientSet , true , value )
595
595
596
596
e2elog .Logf ("DNS probes using %s succeeded\n " , pod .Name )
0 commit comments