e2e: workaround for travis 10 minute no-logs timeout
Travis kills builds if it doesn't see output for 10 minutes.
The end-to-end tests take that long sometimes, and doesn't print any
intermediary output.
Print a log message very 5 minutes to work around it.
FORCE_E2E=true
@@ -12,6 +12,7 @@ import (
"log"
"mime/multipart"
"net/http"
+ "os"
"strings"
"testing"
"time"
@@ -23,6 +24,19 @@ import (
"github.com/GoogleCloudPlatform/golang-samples/internal/testutil"
)
+func init() {
+ // Workaround for Travis:
+ // https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
+ if os.Getenv("TRAVIS") == "true" {
+ go func() {
+ for {
+ time.Sleep(5 * time.Minute)
+ log.Print("Still testing. Don't kill me!")
+ }
+ }()
+ }
+}
+
// env:flex deployments are quite flaky when done in parallel.
// Offset each deployment by some amount of time.
var limit = rate.NewLimiter(rate.Every(15*time.Second), 1)
