Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Fix docker test on OSX
Browse files Browse the repository at this point in the history
Switch to using a tmp dir Docker can bind to.
  • Loading branch information
cevian committed Apr 17, 2020
1 parent 4746881 commit fe45064
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/pgmodel/query_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"net/url"
"reflect"
"runtime"
"testing"
"time"

Expand Down Expand Up @@ -963,7 +964,14 @@ func generateSmallTimeseries() []prompb.TimeSeries {
}

func generatePrometheusWALFile() (string, error) {
path, err := ioutil.TempDir("", "prom_test_storage")
tmpDir := ""

if runtime.GOOS == "darwin" {
// Docker on Mac lacks access to default os tmp dir - "/var/folders/random_number"
// so switch to cross-user tmp dir
tmpDir = "/tmp"
}
path, err := ioutil.TempDir(tmpDir, "prom_test_storage")
if err != nil {
return "", err
}
Expand Down

0 comments on commit fe45064

Please sign in to comment.