@@ -24,6 +24,7 @@ import (
2424 "os"
2525 "path/filepath"
2626 "strings"
27+ "time"
2728
2829 apierrors "k8s.io/apimachinery/pkg/api/errors"
2930
@@ -187,9 +188,22 @@ func DeployAppToWorkloadClusterAndWaitForDeploymentReady(ctx context.Context, wo
187188
188189func DownloadFromAppInWorkloadCluster (ctx context.Context , workloadKubeconfigPath string , appName string , port int , path string ) (string , error ) {
189190 runArgs := []string {
190- "-i" , "--restart=Never" , "dummy" , "--image=dockerqa/curl:ubuntu-trusty" , "--command" , "--" , "curl" , "--silent" , fmt .Sprintf ("%s:%d%s" , appName , port , path ),
191+ // Required by below: container name is runArg zero.
192+ "dummy" , "-i" , "--restart=Never" , "--image=dockerqa/curl:ubuntu-trusty" , "--command" , "--" , "curl" , "--silent" , "--show-error" , fmt .Sprintf ("%s:%d%s" , appName , port , path ),
191193 }
192- return KubectlExec (ctx , "run" , workloadKubeconfigPath , runArgs ... )
194+ var result , err = KubectlExec (ctx , "run" , workloadKubeconfigPath , runArgs ... )
195+ if err != nil {
196+ return result , err
197+ }
198+ if result == "" {
199+ // A single retry to accommodate occasional cases where an empty string is returned, ostensibly
200+ // because the service isn't fully ready. Subsequent requests have always worked.
201+ fmt .Println ("Retrying html download" )
202+ time .Sleep (5 * time .Second )
203+ runArgs [0 ] = "dummy2" // Assumed: container name is runArg zero.
204+ result , err = KubectlExec (ctx , "run" , workloadKubeconfigPath , runArgs ... )
205+ }
206+ return result , err
193207}
194208
195209type cloudConfig struct {
0 commit comments