Skip to content

Commit 7aa86c8

Browse files
author
OpenShift Bot
authored
Merge pull request #13656 from csrwng/buildpod_test_debug
Merged by openshift-bot
2 parents e37455a + 1d1b68f commit 7aa86c8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/common/build/controllers.go

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"sync/atomic"
66
"time"
77

8+
"github.com/golang/glog"
89
kapi "k8s.io/kubernetes/pkg/api"
910
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
1011
"k8s.io/kubernetes/pkg/client/retry"
@@ -224,6 +225,7 @@ func RunBuildPodControllerTest(t testingT, osClient *client.Client, kClient *kcl
224225
if !ok {
225226
t.Fatalf("%s: unexpected object received: %#v\n", test.Name, e.Object)
226227
}
228+
glog.Infof("pod watch event received for pod %s/%s: %v, pod phase: %v", pod.Namespace, pod.Name, e.Type, pod.Status.Phase)
227229
if pod.Status.Phase == kapi.PodPending {
228230
podReadyChan <- pod
229231
break
@@ -277,6 +279,7 @@ func RunBuildPodControllerTest(t testingT, osClient *client.Client, kClient *kcl
277279
if !ok {
278280
errChan <- fmt.Errorf("%s: unexpected object received: %#v", test.Name, e.Object)
279281
}
282+
glog.Infof("build watch event received for build %s/%s: %v, build phase: %v", b.Namespace, b.Name, e.Type, b.Status.Phase)
280283
if e.Type != watchapi.Modified {
281284
errChan <- fmt.Errorf("%s: unexpected event received: %s, object: %#v", test.Name, e.Type, e.Object)
282285
}
@@ -297,6 +300,15 @@ func RunBuildPodControllerTest(t testingT, osClient *client.Client, kClient *kcl
297300
case <-time.After(BuildPodControllerTestWait):
298301
buildWatch.Stop()
299302
if atomic.LoadInt32(&stateReached) != 1 {
303+
// attempt to retrieve build and get current state
304+
func() {
305+
currentBuild, err := osClient.Builds(b.Namespace).Get(b.Name)
306+
if err != nil {
307+
glog.Infof("Cannot get build %s/%s: %v", b.Namespace, b.Name, err)
308+
return
309+
}
310+
glog.Infof("Failing build %s/%s. Current build phase: %s", currentBuild.Namespace, currentBuild.Name, currentBuild.Status.Phase)
311+
}()
300312
t.Errorf("%s: Did not reach desired build state: %s", test.Name, state.BuildPhase)
301313
break
302314
}

0 commit comments

Comments
 (0)