From: Daniel Swarbrick <dswarbrick@debian.org>
Date: Fri, 14 Jul 2023 19:05:46 +0200
Subject: Skip slow / CPU-intensive tests on 32-bit arch / riscv64

Forwarded: not-needed
Last-Update: 2023-02-05

This patch does not imply that the tests need to be made more tolerant
upstream. It merely avoids bogus build failures on overloaded Debian buildd
hosts, where functions may take longer than upstream developers expect, i.e.,
combat the "works on my machine" scenario.
---
 promql/promql_test.go | 5 +++++
 tsdb/agent/db_test.go | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/promql/promql_test.go b/promql/promql_test.go
index a07a0f5..800f739 100644
--- a/promql/promql_test.go
+++ b/promql/promql_test.go
@@ -17,6 +17,7 @@ import (
 	"context"
 	"path/filepath"
 	"strings"
+	"runtime"
 	"testing"
 	"time"
 
@@ -43,6 +44,10 @@ func TestEvaluations(t *testing.T) {
 
 // Run a lot of queries at the same time, to check for race conditions.
 func TestConcurrentRangeQueries(t *testing.T) {
+	if runtime.GOARCH == "386" || runtime.GOARCH == "arm" || runtime.GOARCH == "mipsle" || runtime.GOARCH == "riscv64" {
+		t.Skip("Skipping CPU-intensive test on "+runtime.GOARCH)
+	}
+
 	stor := teststorage.New(t)
 	defer stor.Close()
 	opts := EngineOpts{
diff --git a/tsdb/agent/db_test.go b/tsdb/agent/db_test.go
index 5c71d54..bd89c1d 100644
--- a/tsdb/agent/db_test.go
+++ b/tsdb/agent/db_test.go
@@ -17,6 +17,7 @@ import (
 	"context"
 	"fmt"
 	"path/filepath"
+	"runtime"
 	"strconv"
 	"testing"
 	"time"
@@ -404,6 +405,12 @@ func TestFullTruncateWAL(t *testing.T) {
 }
 
 func TestPartialTruncateWAL(t *testing.T) {
+	// Test appears to delete variable number of series, depending on
+	// performance / load of host's CPU, resulting in unpredictable result.
+	if runtime.GOARCH == "mipsle" || runtime.GOARCH == "mips64le" || runtime.GOARCH == "riscv64" {
+		t.Skip("Skipping flaky test on "+runtime.GOARCH)
+	}
+
 	const (
 		numDatapoints = 1000
 		numSeries     = 800
