diff --git a/utility/test/directory.go b/pkg/testutil/directory.go similarity index 99% rename from utility/test/directory.go rename to pkg/testutil/directory.go index e8a8906ff..84ce10f5a 100644 --- a/utility/test/directory.go +++ b/pkg/testutil/directory.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package test +package testutil import ( "io/ioutil" diff --git a/utility/test/error.go b/pkg/testutil/error.go similarity index 98% rename from utility/test/error.go rename to pkg/testutil/error.go index 56859457b..a132abf8f 100644 --- a/utility/test/error.go +++ b/pkg/testutil/error.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package test +package testutil // ErrorEqual compares Go errors for equality. func ErrorEqual(left, right error) bool { diff --git a/promql/test.go b/promql/test.go index 9bf7e7833..3de3066ac 100644 --- a/promql/test.go +++ b/promql/test.go @@ -29,7 +29,7 @@ import ( "github.com/prometheus/prometheus/storage/metric" "github.com/prometheus/prometheus/utility" - testutil "github.com/prometheus/prometheus/utility/test" + "github.com/prometheus/prometheus/pkg/testutil" ) var ( diff --git a/storage/local/flock/flock_test.go b/storage/local/flock/flock_test.go index d50437a66..645276381 100644 --- a/storage/local/flock/flock_test.go +++ b/storage/local/flock/flock_test.go @@ -5,11 +5,11 @@ import ( "path/filepath" "testing" - "github.com/prometheus/prometheus/utility/test" + "github.com/prometheus/prometheus/pkg/testutil" ) func TestLocking(t *testing.T) { - dir := test.NewTemporaryDirectory("test_flock", t) + dir := testutil.NewTemporaryDirectory("test_flock", t) defer dir.Close() fileName := filepath.Join(dir.Path(), "LOCK") diff --git a/storage/local/persistence_test.go b/storage/local/persistence_test.go index 1bf8b24b7..97dcfb4b0 100644 --- a/storage/local/persistence_test.go +++ b/storage/local/persistence_test.go @@ -20,10 +20,10 @@ import ( clientmodel "github.com/prometheus/client_golang/model" + "github.com/prometheus/prometheus/pkg/testutil" "github.com/prometheus/prometheus/storage/local/codable" "github.com/prometheus/prometheus/storage/local/index" "github.com/prometheus/prometheus/storage/metric" - "github.com/prometheus/prometheus/utility/test" ) var ( @@ -34,16 +34,16 @@ var ( m5 = clientmodel.Metric{"label": "value5"} ) -func newTestPersistence(t *testing.T, encoding chunkEncoding) (*persistence, test.Closer) { +func newTestPersistence(t *testing.T, encoding chunkEncoding) (*persistence, testutil.Closer) { *defaultChunkEncoding = int(encoding) - dir := test.NewTemporaryDirectory("test_persistence", t) + dir := testutil.NewTemporaryDirectory("test_persistence", t) p, err := newPersistence(dir.Path(), false, false, func() bool { return false }) if err != nil { dir.Close() t.Fatal(err) } go p.run() - return p, test.NewCallbackCloser(func() { + return p, testutil.NewCallbackCloser(func() { p.close() dir.Close() }) diff --git a/storage/local/storage_test.go b/storage/local/storage_test.go index 0b43aa1eb..418af3e72 100644 --- a/storage/local/storage_test.go +++ b/storage/local/storage_test.go @@ -24,8 +24,8 @@ import ( clientmodel "github.com/prometheus/client_golang/model" + "github.com/prometheus/prometheus/pkg/testutil" "github.com/prometheus/prometheus/storage/metric" - "github.com/prometheus/prometheus/utility/test" ) func TestFingerprintsForLabelMatchers(t *testing.T) { @@ -217,7 +217,7 @@ func TestLoop(t *testing.T) { Value: clientmodel.SampleValue(float64(i) * 0.2), } } - directory := test.NewTemporaryDirectory("test_storage", t) + directory := testutil.NewTemporaryDirectory("test_storage", t) defer directory.Close() o := &MemorySeriesStorageOptions{ MemoryChunks: 50, @@ -902,7 +902,7 @@ func benchmarkFuzz(b *testing.B, encoding chunkEncoding) { *defaultChunkEncoding = int(encoding) const samplesPerRun = 100000 rand.Seed(42) - directory := test.NewTemporaryDirectory("test_storage", b) + directory := testutil.NewTemporaryDirectory("test_storage", b) defer directory.Close() o := &MemorySeriesStorageOptions{ MemoryChunks: 100, diff --git a/storage/local/test_helpers.go b/storage/local/test_helpers.go index 21f6aa008..44c71c4a1 100644 --- a/storage/local/test_helpers.go +++ b/storage/local/test_helpers.go @@ -21,12 +21,12 @@ package local import ( "time" - "github.com/prometheus/prometheus/utility/test" + "github.com/prometheus/prometheus/pkg/testutil" ) type testStorageCloser struct { storage Storage - directory test.Closer + directory testutil.Closer } func (t *testStorageCloser) Close() { @@ -37,9 +37,9 @@ func (t *testStorageCloser) Close() { // NewTestStorage creates a storage instance backed by files in a temporary // directory. The returned storage is already in serving state. Upon closing the // returned test.Closer, the temporary directory is cleaned up. -func NewTestStorage(t test.T, encoding chunkEncoding) (*memorySeriesStorage, test.Closer) { +func NewTestStorage(t testutil.T, encoding chunkEncoding) (*memorySeriesStorage, testutil.Closer) { *defaultChunkEncoding = int(encoding) - directory := test.NewTemporaryDirectory("test_storage", t) + directory := testutil.NewTemporaryDirectory("test_storage", t) o := &MemorySeriesStorageOptions{ MemoryChunks: 1000000, MaxChunksToPersist: 1000000,