From 66b6b87cd4ce563d711da437734353c8320f0f60 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Mon, 22 Oct 2018 22:19:52 +0300 Subject: [PATCH] fix windows tests (#421) Signed-off-by: Krasi Georgiev --- repair_test.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/repair_test.go b/repair_test.go index ba0295c6d..9a43a6d1d 100644 --- a/repair_test.go +++ b/repair_test.go @@ -2,6 +2,7 @@ package tsdb import ( "os" + "path/filepath" "testing" "github.com/prometheus/tsdb/chunks" @@ -45,9 +46,9 @@ func TestRepairBadIndexVersion(t *testing.T) { // panic(err) // } // } - const dbDir = "testdata/repair_index_version/01BZJ9WJQPWHGNC2W4J9TA62KC" - tmpDir := "testdata/repair_index_version/copy" - tmpDbDir := tmpDir + "/3MCNSQ8S31EHGJYWK5E1GPJWJZ" + dbDir := filepath.Join("testdata", "repair_index_version", "01BZJ9WJQPWHGNC2W4J9TA62KC") + tmpDir := filepath.Join("testdata", "repair_index_version", "copy") + tmpDbDir := filepath.Join(tmpDir, "3MCNSQ8S31EHGJYWK5E1GPJWJZ") // Check the current db. // In its current state, lookups should fail with the fixed code. @@ -55,10 +56,10 @@ func TestRepairBadIndexVersion(t *testing.T) { testutil.NotOk(t, err) // Touch chunks dir in block. - os.MkdirAll(dbDir+"/chunks", 0777) - defer os.RemoveAll(dbDir + "/chunks") + os.MkdirAll(filepath.Join(dbDir, "chunks"), 0777) + defer os.RemoveAll(filepath.Join(dbDir, "chunks")) - r, err := index.NewFileReader(dbDir + "/index") + r, err := index.NewFileReader(filepath.Join(dbDir, "index")) testutil.Ok(t, err) p, err := r.Postings("b", "1") testutil.Ok(t, err) @@ -81,7 +82,7 @@ func TestRepairBadIndexVersion(t *testing.T) { testutil.Ok(t, err) db.Close() - r, err = index.NewFileReader(tmpDbDir + "/index") + r, err = index.NewFileReader(filepath.Join(tmpDbDir, "index")) testutil.Ok(t, err) p, err = r.Postings("b", "1") testutil.Ok(t, err)