From: Daniel Swarbrick <dswarbrick@debian.org>
Date: Fri, 14 Jul 2023 19:05:46 +0200
Subject: Disable memory-intensive tests which are known to fail on 32-bit

Forwarded: not-needed
Bug: https://github.com/prometheus/prometheus/issues/10869
Last-Update: 2023-02-05
---
 cmd/promtool/unittest_test.go |  3 +++
 tsdb/db_test.go               |  2 ++
 tsdb/deb_helpers_test.go      | 14 ++++++++++++++
 tsdb/head_test.go             |  8 ++++++++
 4 files changed, 27 insertions(+)
 create mode 100644 tsdb/deb_helpers_test.go

diff --git a/cmd/promtool/unittest_test.go b/cmd/promtool/unittest_test.go
index 1e02440..5a541c9 100644
--- a/cmd/promtool/unittest_test.go
+++ b/cmd/promtool/unittest_test.go
@@ -11,6 +11,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//go:build !386 && !arm && !mipsle
+// +build !386,!arm,!mipsle
+
 package main
 
 import (
diff --git a/tsdb/db_test.go b/tsdb/db_test.go
index 427a3b7..c8b083b 100644
--- a/tsdb/db_test.go
+++ b/tsdb/db_test.go
@@ -6336,6 +6336,8 @@ func testHistogramAppendAndQueryHelper(t *testing.T, floatHistogram bool) {
 }
 
 func TestQueryHistogramFromBlocksWithCompaction(t *testing.T) {
+	skip32bit(t)
+
 	minute := func(m int) int64 { return int64(m) * time.Minute.Milliseconds() }
 
 	testBlockQuerying := func(t *testing.T, blockSeries ...[]storage.Series) {
diff --git a/tsdb/deb_helpers_test.go b/tsdb/deb_helpers_test.go
new file mode 100644
index 0000000..eccb44e
--- /dev/null
+++ b/tsdb/deb_helpers_test.go
@@ -0,0 +1,14 @@
+package tsdb
+
+import (
+	"runtime"
+	"testing"
+)
+
+func skip32bit(t *testing.T) {
+	t.Helper()
+
+	if runtime.GOARCH == "386" || runtime.GOARCH == "arm" || runtime.GOARCH == "mipsle" {
+		t.Skip("Skipping memory-intensive test on 32-bit arch")
+	}
+}
diff --git a/tsdb/head_test.go b/tsdb/head_test.go
index 14468e0..14a8906 100644
--- a/tsdb/head_test.go
+++ b/tsdb/head_test.go
@@ -604,6 +604,8 @@ func TestHead_ReadWAL(t *testing.T) {
 }
 
 func TestHead_WALMultiRef(t *testing.T) {
+	skip32bit(t)
+
 	head, w := newTestHead(t, 1000, false, false)
 
 	require.NoError(t, head.Init(0))
@@ -1052,6 +1054,8 @@ func TestDeleteUntilCurMax(t *testing.T) {
 }
 
 func TestDeletedSamplesAndSeriesStillInWALAfterCheckpoint(t *testing.T) {
+	skip32bit(t)
+
 	numSamples := 10000
 
 	// Enough samples to cause a checkpoint.
@@ -1772,6 +1776,8 @@ func TestWalRepair_DecodingError(t *testing.T) {
 }
 
 func TestHeadReadWriterRepair(t *testing.T) {
+	skip32bit(t)
+
 	dir := t.TempDir()
 
 	const chunkRange = 1000
@@ -3168,6 +3174,8 @@ func TestHistogramInWALAndMmapChunk(t *testing.T) {
 }
 
 func TestChunkSnapshot(t *testing.T) {
+	skip32bit(t)
+
 	head, _ := newTestHead(t, 120*4, false, false)
 	defer func() {
 		head.opts.EnableMemorySnapshotOnShutdown = false
