sweet: require heap profiles to be available in cockroach benchmark
Currently the cockroachdb benchmark is failing in TestSweetEndToEnd
because CPU profiling fails (and thus PGO-based builds fail). Fix this
by requiring that some profile be obtainable for each instance before
starting the benchmark properly. I suspect there is an internal race,
wherein even if the server is up and running by some metric, CPU
profiles aren't yet ready.
For #56958.
Change-Id: I4c907b4394f249f3f1cac6768e641fafda20f511
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/614536
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/sweet/benchmarks/cockroachdb/main.go b/sweet/benchmarks/cockroachdb/main.go
index 0d0979c..ea620e2 100644
--- a/sweet/benchmarks/cockroachdb/main.go
+++ b/sweet/benchmarks/cockroachdb/main.go
@@ -13,6 +13,7 @@
"flag"
"fmt"
"log"
+ "net/http"
"os"
"os/exec"
"path/filepath"
@@ -255,6 +256,15 @@
if err := cmd.Run(); err != nil {
return err
}
+ // Check to see if profiling works. We don't care what the data is, we just want to
+ // make sure that it doesn't fail. We've unfortunately seen this fail before.
+ // See #56958.
+ endpoint := fmt.Sprintf("http://%s:%d/%s", cfg.host, i.httpPort, diagnostics.MemProfile.HTTPEndpoint())
+ resp, err := http.Get(endpoint)
+ if err != nil {
+ return err
+ }
+ resp.Body.Close()
return nil
}