mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Revert "Adding small test update for temp dir using t.TempDir (#13293)"
This reverts commit 2ddb3596ef
.
Various tests are failing in CI after this change; reverting to free up
other work.
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
2ddb3596ef
commit
252031c86f
|
@ -18,6 +18,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -46,7 +47,9 @@ func TestMain(m *testing.M) {
|
|||
func TestQueryConcurrency(t *testing.T) {
|
||||
maxConcurrency := 10
|
||||
|
||||
dir := t.TempDir()
|
||||
dir, err := os.MkdirTemp("", "test_concurrency")
|
||||
require.NoError(t, err)
|
||||
defer os.RemoveAll(dir)
|
||||
queryTracker := NewActiveQueryTracker(dir, maxConcurrency, nil)
|
||||
t.Cleanup(queryTracker.Close)
|
||||
|
||||
|
|
|
@ -60,8 +60,12 @@ func TestDirLockerUsage(t *testing.T, open func(t *testing.T, data string, creat
|
|||
|
||||
for _, c := range cases {
|
||||
t.Run(fmt.Sprintf("%+v", c), func(t *testing.T) {
|
||||
tmpdir := t.TempDir()
|
||||
|
||||
tmpdir, err := os.MkdirTemp("", "test")
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() {
|
||||
require.NoError(t, os.RemoveAll(tmpdir))
|
||||
})
|
||||
|
||||
// Test preconditions (file already exists + lockfile option)
|
||||
if c.fileAlreadyExists {
|
||||
tmpLocker, err := NewDirLocker(tmpdir, "tsdb", log.NewNopLogger(), nil)
|
||||
|
@ -78,7 +82,7 @@ func TestDirLockerUsage(t *testing.T, open func(t *testing.T, data string, creat
|
|||
|
||||
// Check that the lockfile is always deleted
|
||||
if !c.lockFileDisabled {
|
||||
_, err := os.Stat(locker.path)
|
||||
_, err = os.Stat(locker.path)
|
||||
require.True(t, os.IsNotExist(err), "lockfile was not deleted")
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue