@@ -18,6 +18,7 @@ package integration
18
18
19
19
import (
20
20
"context"
21
+ "fmt"
21
22
"os/exec"
22
23
"testing"
23
24
"time"
@@ -95,6 +96,7 @@ func (k *NSKubernetesClient) WaitForPodsReady(podNames ...string) {
95
96
waitLoop:
96
97
select {
97
98
case <- ctx .Done ():
99
+ k .debug ("pods" )
98
100
k .t .Fatalf ("Timed out waiting for pods %v ready in namespace %s" , podNames , k .ns )
99
101
100
102
case event := <- w .ResultChan ():
@@ -147,6 +149,8 @@ func (k *NSKubernetesClient) WaitForDeploymentsToStabilize(depNames ...string) {
147
149
waitLoop:
148
150
select {
149
151
case <- ctx .Done ():
152
+ k .debug ("deployments.apps" )
153
+ k .debug ("pods" )
150
154
k .t .Fatalf ("Timed out waiting for deployments %v to stabilize in namespace %s" , depNames , k .ns )
151
155
152
156
case event := <- w .ResultChan ():
@@ -167,6 +171,16 @@ func (k *NSKubernetesClient) WaitForDeploymentsToStabilize(depNames ...string) {
167
171
}
168
172
}
169
173
174
+ // debug is used to print all the details about pods or deployments
175
+ func (k * NSKubernetesClient ) debug (entities string ) {
176
+ cmd := exec .Command ("kubectl" , "-n" , k .ns , "get" , entities , "-oyaml" )
177
+ out , _ := cmd .CombinedOutput ()
178
+
179
+ logrus .Warnln (cmd .Args )
180
+ // Use fmt.Println, not logrus, for prettier output
181
+ fmt .Println (string (out ))
182
+ }
183
+
170
184
func isStable (dp * appsv1.Deployment ) bool {
171
185
return dp .Generation <= dp .Status .ObservedGeneration && * (dp .Spec .Replicas ) == dp .Status .Replicas
172
186
}
0 commit comments