@@ -60,6 +60,7 @@ import (
60
60
"k8s.io/kubernetes/test/e2e/framework"
61
61
"k8s.io/kubernetes/test/e2e/framework/auth"
62
62
jobutil "k8s.io/kubernetes/test/e2e/framework/job"
63
+ e2elog "k8s.io/kubernetes/test/e2e/framework/log"
63
64
"k8s.io/kubernetes/test/e2e/framework/testfiles"
64
65
"k8s.io/kubernetes/test/e2e/scheduling"
65
66
testutils "k8s.io/kubernetes/test/utils"
@@ -140,7 +141,7 @@ func runKubectlRetryOrDie(args ...string) string {
140
141
}
141
142
// Expect no errors to be present after retries are finished
142
143
// Copied from framework #ExecOrDie
143
- framework .Logf ("stdout: %q" , output )
144
+ e2elog .Logf ("stdout: %q" , output )
144
145
framework .ExpectNoError (err )
145
146
return output
146
147
}
@@ -234,7 +235,7 @@ var _ = SIGDescribe("Kubectl client", func() {
234
235
debugDiscovery := func () {
235
236
home := os .Getenv ("HOME" )
236
237
if len (home ) == 0 {
237
- framework .Logf ("no $HOME envvar set" )
238
+ e2elog .Logf ("no $HOME envvar set" )
238
239
return
239
240
}
240
241
@@ -250,17 +251,17 @@ var _ = SIGDescribe("Kubectl client", func() {
250
251
if len (parts ) != 3 || parts [1 ] != "v1" || parts [2 ] != "serverresources.json" {
251
252
return nil
252
253
}
253
- framework .Logf ("%s modified at %s (current time: %s)" , path , info .ModTime (), time .Now ())
254
+ e2elog .Logf ("%s modified at %s (current time: %s)" , path , info .ModTime (), time .Now ())
254
255
255
256
data , readError := ioutil .ReadFile (path )
256
257
if readError != nil {
257
- framework .Logf ("%s error: %v" , path , readError )
258
+ e2elog .Logf ("%s error: %v" , path , readError )
258
259
} else {
259
- framework .Logf ("%s content: %s" , path , string (data ))
260
+ e2elog .Logf ("%s content: %s" , path , string (data ))
260
261
}
261
262
return nil
262
263
})
263
- framework .Logf ("scanned %s for discovery docs: %v" , home , err )
264
+ e2elog .Logf ("scanned %s for discovery docs: %v" , home , err )
264
265
}
265
266
266
267
framework .KubeDescribe ("Update Demo" , func () {
@@ -348,7 +349,7 @@ var _ = SIGDescribe("Kubectl client", func() {
348
349
})
349
350
ginkgo .By ("creating all guestbook components" )
350
351
forEachGBFile (func (contents string ) {
351
- framework .Logf (contents )
352
+ e2elog .Logf (contents )
352
353
framework .RunKubectlOrDieInput (contents , "create" , "-f" , "-" , fmt .Sprintf ("--namespace=%v" , ns ))
353
354
})
354
355
@@ -604,7 +605,7 @@ var _ = SIGDescribe("Kubectl client", func() {
604
605
ginkgo .By ("curling local port output" )
605
606
localAddr := fmt .Sprintf ("http://localhost:%d" , cmd .port )
606
607
body , err := curl (localAddr )
607
- framework .Logf ("got: %s" , body )
608
+ e2elog .Logf ("got: %s" , body )
608
609
if err != nil {
609
610
framework .Failf ("Failed http.Get of forwarded port (%s): %v" , localAddr , err )
610
611
}
@@ -639,7 +640,7 @@ var _ = SIGDescribe("Kubectl client", func() {
639
640
inClusterHost := strings .TrimSpace (framework .RunHostCmdOrDie (ns , simplePodName , "printenv KUBERNETES_SERVICE_HOST" ))
640
641
inClusterPort := strings .TrimSpace (framework .RunHostCmdOrDie (ns , simplePodName , "printenv KUBERNETES_SERVICE_PORT" ))
641
642
642
- framework .Logf ("copying %s to the %s pod" , kubectlPath , simplePodName )
643
+ e2elog .Logf ("copying %s to the %s pod" , kubectlPath , simplePodName )
643
644
framework .RunKubectlOrDie ("cp" , kubectlPath , ns + "/" + simplePodName + ":/tmp/" )
644
645
645
646
// Build a kubeconfig file that will make use of the injected ca and token,
@@ -669,7 +670,7 @@ users:
669
670
user:
670
671
tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
671
672
` ), os .FileMode (0755 )))
672
- framework .Logf ("copying override kubeconfig to the %s pod" , simplePodName )
673
+ e2elog .Logf ("copying override kubeconfig to the %s pod" , simplePodName )
673
674
framework .RunKubectlOrDie ("cp" , filepath .Join (tmpDir , overrideKubeconfigName ), ns + "/" + simplePodName + ":/tmp/" )
674
675
675
676
framework .ExpectNoError (ioutil .WriteFile (filepath .Join (tmpDir , "invalid-configmap-with-namespace.yaml" ), []byte (`
@@ -685,7 +686,7 @@ apiVersion: v1
685
686
metadata:
686
687
name: "configmap without namespace and invalid name"
687
688
` ), os .FileMode (0755 )))
688
- framework .Logf ("copying configmap manifests to the %s pod" , simplePodName )
689
+ e2elog .Logf ("copying configmap manifests to the %s pod" , simplePodName )
689
690
framework .RunKubectlOrDie ("cp" , filepath .Join (tmpDir , "invalid-configmap-with-namespace.yaml" ), ns + "/" + simplePodName + ":/tmp/" )
690
691
framework .RunKubectlOrDie ("cp" , filepath .Join (tmpDir , "invalid-configmap-without-namespace.yaml" ), ns + "/" + simplePodName + ":/tmp/" )
691
692
@@ -709,7 +710,7 @@ metadata:
709
710
710
711
ginkgo .By ("trying to use kubectl with invalid token" )
711
712
_ , err = framework .RunHostCmd (ns , simplePodName , "/tmp/kubectl get pods --token=invalid --v=7 2>&1" )
712
- framework .Logf ("got err %v" , err )
713
+ e2elog .Logf ("got err %v" , err )
713
714
gomega .Expect (err ).To (gomega .HaveOccurred ())
714
715
gomega .Expect (err ).To (gomega .ContainSubstring ("Using in-cluster namespace" ))
715
716
gomega .Expect (err ).To (gomega .ContainSubstring ("Using in-cluster configuration" ))
@@ -718,7 +719,7 @@ metadata:
718
719
719
720
ginkgo .By ("trying to use kubectl with invalid server" )
720
721
_ , err = framework .RunHostCmd (ns , simplePodName , "/tmp/kubectl get pods --server=invalid --v=6 2>&1" )
721
- framework .Logf ("got err %v" , err )
722
+ e2elog .Logf ("got err %v" , err )
722
723
gomega .Expect (err ).To (gomega .HaveOccurred ())
723
724
gomega .Expect (err ).To (gomega .ContainSubstring ("Unable to connect to the server" ))
724
725
gomega .Expect (err ).To (gomega .ContainSubstring ("GET http://invalid/api" ))
@@ -1059,22 +1060,22 @@ metadata:
1059
1060
1060
1061
ginkgo .By ("creating Redis RC" )
1061
1062
1062
- framework .Logf ("namespace %v" , ns )
1063
+ e2elog .Logf ("namespace %v" , ns )
1063
1064
framework .RunKubectlOrDieInput (controllerJSON , "create" , "-f" , "-" , nsFlag )
1064
1065
1065
1066
// It may take a while for the pods to get registered in some cases, wait to be sure.
1066
1067
ginkgo .By ("Waiting for Redis master to start." )
1067
1068
waitForOrFailWithDebug (1 )
1068
1069
forEachPod (func (pod v1.Pod ) {
1069
- framework .Logf ("wait on redis-master startup in %v " , ns )
1070
+ e2elog .Logf ("wait on redis-master startup in %v " , ns )
1070
1071
framework .LookForStringInLog (ns , pod .Name , "redis-master" , "The server is now ready to accept connections" , framework .PodStartTimeout )
1071
1072
})
1072
1073
validateService := func (name string , servicePort int , timeout time.Duration ) {
1073
1074
err := wait .Poll (framework .Poll , timeout , func () (bool , error ) {
1074
1075
endpoints , err := c .CoreV1 ().Endpoints (ns ).Get (name , metav1.GetOptions {})
1075
1076
if err != nil {
1076
1077
// log the real error
1077
- framework .Logf ("Get endpoints failed (interval %v): %v" , framework .Poll , err )
1078
+ e2elog .Logf ("Get endpoints failed (interval %v): %v" , framework .Poll , err )
1078
1079
1079
1080
// if the error is API not found or could not find default credentials or TLS handshake timeout, try again
1080
1081
if apierrs .IsNotFound (err ) ||
@@ -1087,7 +1088,7 @@ metadata:
1087
1088
1088
1089
uidToPort := framework .GetContainerPortsByPodUID (endpoints )
1089
1090
if len (uidToPort ) == 0 {
1090
- framework .Logf ("No endpoint found, retrying" )
1091
+ e2elog .Logf ("No endpoint found, retrying" )
1091
1092
return false , nil
1092
1093
}
1093
1094
if len (uidToPort ) > 1 {
@@ -2070,21 +2071,21 @@ func curl(url string) (string, error) {
2070
2071
}
2071
2072
2072
2073
func validateGuestbookApp (c clientset.Interface , ns string ) {
2073
- framework .Logf ("Waiting for all frontend pods to be Running." )
2074
+ e2elog .Logf ("Waiting for all frontend pods to be Running." )
2074
2075
label := labels .SelectorFromSet (labels .Set (map [string ]string {"tier" : "frontend" , "app" : "guestbook" }))
2075
2076
err := testutils .WaitForPodsWithLabelRunning (c , ns , label )
2076
2077
framework .ExpectNoError (err )
2077
- framework .Logf ("Waiting for frontend to serve content." )
2078
+ e2elog .Logf ("Waiting for frontend to serve content." )
2078
2079
if ! waitForGuestbookResponse (c , "get" , "" , `{"data": ""}` , guestbookStartupTimeout , ns ) {
2079
2080
framework .Failf ("Frontend service did not start serving content in %v seconds." , guestbookStartupTimeout .Seconds ())
2080
2081
}
2081
2082
2082
- framework .Logf ("Trying to add a new entry to the guestbook." )
2083
+ e2elog .Logf ("Trying to add a new entry to the guestbook." )
2083
2084
if ! waitForGuestbookResponse (c , "set" , "TestEntry" , `{"message": "Updated"}` , guestbookResponseTimeout , ns ) {
2084
2085
framework .Failf ("Cannot added new entry in %v seconds." , guestbookResponseTimeout .Seconds ())
2085
2086
}
2086
2087
2087
- framework .Logf ("Verifying that added entry can be retrieved." )
2088
+ e2elog .Logf ("Verifying that added entry can be retrieved." )
2088
2089
if ! waitForGuestbookResponse (c , "get" , "" , `{"data": "TestEntry"}` , guestbookResponseTimeout , ns ) {
2089
2090
framework .Failf ("Entry to guestbook wasn't correctly added in %v seconds." , guestbookResponseTimeout .Seconds ())
2090
2091
}
@@ -2097,7 +2098,7 @@ func waitForGuestbookResponse(c clientset.Interface, cmd, arg, expectedResponse
2097
2098
if err == nil && res == expectedResponse {
2098
2099
return true
2099
2100
}
2100
- framework .Logf ("Failed to get response from guestbook. err: %v, response: %s" , err , res )
2101
+ e2elog .Logf ("Failed to get response from guestbook. err: %v, response: %s" , err , res )
2101
2102
}
2102
2103
return false
2103
2104
}
@@ -2192,7 +2193,7 @@ func getUDData(jpgExpected string, ns string) func(clientset.Interface, string)
2192
2193
2193
2194
// getUDData validates data.json in the update-demo (returns nil if data is ok).
2194
2195
return func (c clientset.Interface , podID string ) error {
2195
- framework .Logf ("validating pod %s" , podID )
2196
+ e2elog .Logf ("validating pod %s" , podID )
2196
2197
2197
2198
ctx , cancel := context .WithTimeout (context .Background (), framework .SingleCallTimeout )
2198
2199
defer cancel ()
@@ -2212,12 +2213,12 @@ func getUDData(jpgExpected string, ns string) func(clientset.Interface, string)
2212
2213
}
2213
2214
return err
2214
2215
}
2215
- framework .Logf ("got data: %s" , body )
2216
+ e2elog .Logf ("got data: %s" , body )
2216
2217
var data updateDemoData
2217
2218
if err := json .Unmarshal (body , & data ); err != nil {
2218
2219
return err
2219
2220
}
2220
- framework .Logf ("Unmarshalled json jpg/img => %s , expecting %s ." , data , jpgExpected )
2221
+ e2elog .Logf ("Unmarshalled json jpg/img => %s , expecting %s ." , data , jpgExpected )
2221
2222
if strings .Contains (data .Image , jpgExpected ) {
2222
2223
return nil
2223
2224
}
0 commit comments