From 85a30deb727b8907eb82ec7fc6979deb94bb8c04 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Fri, 15 Feb 2019 11:14:54 +0100 Subject: [PATCH] Try using tmpfs partition Signed-off-by: Simon Pasquier --- .circleci/config.yml | 1 - .travis.yml | 4 +++- storage/remote/wal_watcher_test.go | 13 +++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 20d5ca9b73..6416a2e74d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,7 +14,6 @@ jobs: steps: - checkout - - run: go test -race -v ./storage/remote/... - run: make promu - run: make check_license style unused staticcheck build check_assets - run: diff --git a/.travis.yml b/.travis.yml index a2f20b5840..41c44d165b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,8 @@ go_import_path: github.com/prometheus/prometheus script: - df -h -- go test -race -v ./storage/remote/... +- sudo mkdir /run/tmptest +- "sudo chown $(id -u):$(id -g) /run/tmptest" +- BASE_TMP_DIR=/run/tmptest go test -race -v ./storage/remote/... - make check_license style unused test staticcheck check_assets - git diff --exit-code diff --git a/storage/remote/wal_watcher_test.go b/storage/remote/wal_watcher_test.go index e89583ea7c..d6781828e8 100644 --- a/storage/remote/wal_watcher_test.go +++ b/storage/remote/wal_watcher_test.go @@ -32,6 +32,7 @@ import ( ) var defaultRetry = 100 * time.Millisecond +var baseTmpDir = os.Getenv("BASE_TMP_DIR") // retry executes f() n times at each interval until it returns true. func retry(t *testing.T, interval time.Duration, n int, f func() bool) { @@ -109,7 +110,7 @@ func Test_readToEnd_noCheckpoint(t *testing.T) { const seriesCount = 10 const samplesCount = 250 - dir, err := ioutil.TempDir("", "readToEnd_noCheckpoint") + dir, err := ioutil.TempDir(baseTmpDir, "readToEnd_noCheckpoint") testutil.Ok(t, err) defer os.RemoveAll(dir) wdir := path.Join(dir, "wal") @@ -172,7 +173,7 @@ func Test_readToEnd_withCheckpoint(t *testing.T) { const seriesCount = 10 const samplesCount = 250 - dir, err := ioutil.TempDir("", "readToEnd_withCheckpoint") + dir, err := ioutil.TempDir(baseTmpDir, "readToEnd_withCheckpoint") testutil.Ok(t, err) defer os.RemoveAll(dir) @@ -255,7 +256,7 @@ func Test_readCheckpoint(t *testing.T) { const seriesCount = 10 const samplesCount = 250 - dir, err := ioutil.TempDir("", "readCheckpoint") + dir, err := ioutil.TempDir(baseTmpDir, "readCheckpoint") testutil.Ok(t, err) defer os.RemoveAll(dir) @@ -317,7 +318,7 @@ func Test_checkpoint_seriesReset(t *testing.T) { const seriesCount = 10 const samplesCount = 250 - dir, err := ioutil.TempDir("", "seriesReset") + dir, err := ioutil.TempDir(baseTmpDir, "seriesReset") testutil.Ok(t, err) defer os.RemoveAll(dir) @@ -382,7 +383,7 @@ func Test_checkpoint_seriesReset(t *testing.T) { } func Test_decodeRecord(t *testing.T) { - dir, err := ioutil.TempDir("", "decodeRecord") + dir, err := ioutil.TempDir(baseTmpDir, "decodeRecord") testutil.Ok(t, err) defer os.RemoveAll(dir) @@ -407,7 +408,7 @@ func Test_decodeRecord(t *testing.T) { } func Test_decodeRecord_afterStart(t *testing.T) { - dir, err := ioutil.TempDir("", "decodeRecord") + dir, err := ioutil.TempDir(baseTmpDir, "decodeRecord") testutil.Ok(t, err) defer os.RemoveAll(dir)