5
5
"sync/atomic"
6
6
"time"
7
7
8
+ "github.com/golang/glog"
8
9
kapi "k8s.io/kubernetes/pkg/api"
9
10
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
10
11
"k8s.io/kubernetes/pkg/client/retry"
@@ -224,6 +225,7 @@ func RunBuildPodControllerTest(t testingT, osClient *client.Client, kClient *kcl
224
225
if ! ok {
225
226
t .Fatalf ("%s: unexpected object received: %#v\n " , test .Name , e .Object )
226
227
}
228
+ glog .Infof ("pod watch event received for pod %s/%s: %v, pod phase: %v" , pod .Namespace , pod .Name , e .Type , pod .Status .Phase )
227
229
if pod .Status .Phase == kapi .PodPending {
228
230
podReadyChan <- pod
229
231
break
@@ -277,6 +279,7 @@ func RunBuildPodControllerTest(t testingT, osClient *client.Client, kClient *kcl
277
279
if ! ok {
278
280
errChan <- fmt .Errorf ("%s: unexpected object received: %#v" , test .Name , e .Object )
279
281
}
282
+ glog .Infof ("build watch event received for build %s/%s: %v, build phase: %v" , b .Namespace , b .Name , e .Type , b .Status .Phase )
280
283
if e .Type != watchapi .Modified {
281
284
errChan <- fmt .Errorf ("%s: unexpected event received: %s, object: %#v" , test .Name , e .Type , e .Object )
282
285
}
@@ -297,6 +300,15 @@ func RunBuildPodControllerTest(t testingT, osClient *client.Client, kClient *kcl
297
300
case <- time .After (BuildPodControllerTestWait ):
298
301
buildWatch .Stop ()
299
302
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
+ }()
300
312
t .Errorf ("%s: Did not reach desired build state: %s" , test .Name , state .BuildPhase )
301
313
break
302
314
}
0 commit comments