From ff4d5d1b766313d51e7a7e72d15ed6d41c8635f2 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Fri, 9 Feb 2024 06:42:27 -0500 Subject: [PATCH] fix --- pmtiles/bucket_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pmtiles/bucket_test.go b/pmtiles/bucket_test.go index 1d81482..7d19146 100644 --- a/pmtiles/bucket_test.go +++ b/pmtiles/bucket_test.go @@ -118,14 +118,14 @@ func TestHttpBucketRequestRequestEtagFailed(t *testing.T) { } func TestFileBucketReplace(t *testing.T) { - dir := t.TempDir() + dir := t.TempDir() + string(os.PathSeparator) bucketURL, _, err := NormalizeBucketKey("", dir, "") assert.Nil(t, err) fmt.Println(bucketURL) bucket, err := OpenBucket(context.Background(), bucketURL, "") assert.Nil(t, err) assert.NotNil(t, bucket) - assert.Nil(t, os.WriteFile(dir+"/archive.pmtiles", []byte{1, 2, 3}, 0666)) + assert.Nil(t, os.WriteFile(dir+"archive.pmtiles", []byte{1, 2, 3}, 0666)) // first read from file reader, etag1, err := bucket.NewRangeReaderEtag(context.Background(), "archive.pmtiles", 1, 1, "") @@ -135,7 +135,7 @@ func TestFileBucketReplace(t *testing.T) { assert.Equal(t, []byte{2}, data) // change file, verify etag changes - assert.Nil(t, os.WriteFile(dir+"/archive.pmtiles", []byte{4, 5, 6, 7}, 0666)) + assert.Nil(t, os.WriteFile(dir+"archive.pmtiles", []byte{4, 5, 6, 7}, 0666)) reader, etag2, err := bucket.NewRangeReaderEtag(context.Background(), "archive.pmtiles", 1, 1, "") assert.Nil(t, err) data, err = io.ReadAll(reader) @@ -149,9 +149,9 @@ func TestFileBucketReplace(t *testing.T) { } func TestFileBucketRename(t *testing.T) { - dir := t.TempDir() - assert.Nil(t, os.WriteFile(dir+"/archive.pmtiles", []byte{1, 2, 3}, 0666)) - assert.Nil(t, os.WriteFile(dir+"/archive2.pmtiles", []byte{4, 5, 6, 7}, 0666)) + dir := t.TempDir() + string(os.PathSeparator) + assert.Nil(t, os.WriteFile(dir+"archive.pmtiles", []byte{1, 2, 3}, 0666)) + assert.Nil(t, os.WriteFile(dir+"archive2.pmtiles", []byte{4, 5, 6, 7}, 0666)) bucketURL, _, err := NormalizeBucketKey("", dir, "") assert.Nil(t, err) @@ -159,7 +159,7 @@ func TestFileBucketRename(t *testing.T) { bucket, err := OpenBucket(context.Background(), bucketURL, "") assert.Nil(t, err) assert.NotNil(t, bucket) - assert.Nil(t, os.WriteFile(dir+"/archive.pmtiles", []byte{1, 2, 3}, 0666)) + assert.Nil(t, os.WriteFile(dir+"archive.pmtiles", []byte{1, 2, 3}, 0666)) // first read from file reader, etag1, err := bucket.NewRangeReaderEtag(context.Background(), "archive.pmtiles", 1, 1, "") @@ -169,8 +169,8 @@ func TestFileBucketRename(t *testing.T) { assert.Equal(t, []byte{2}, data) // change file, verify etag changes - os.Rename(dir+"/archive.pmtiles", dir+"/archive3.pmtiles") - os.Rename(dir+"/archive2.pmtiles", dir+"/archive.pmtiles") + os.Rename(dir+"archive.pmtiles", dir+"archive3.pmtiles") + os.Rename(dir+"archive2.pmtiles", dir+"archive.pmtiles") reader, etag2, err := bucket.NewRangeReaderEtag(context.Background(), "archive.pmtiles", 1, 1, "") assert.Nil(t, err) data, err = io.ReadAll(reader)