Skip to content

Commit

Permalink
Add test cases for open disk partition
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Jun 23, 2021
1 parent fd604ed commit 3041d28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func newSeriesDecoder(r io.Reader) (seriesDecoder, error) {
return nil, fmt.Errorf("failed to new gzip reader: %w", err)
}

// FIXME: Use another way to write decompressed data and turn it into io.ReadSeeker
buf := new(bytes.Buffer)
if _, err := io.Copy(buf, gzipReader); err != nil {
return nil, fmt.Errorf("failed to copy bytes: %w", err)
Expand Down
22 changes: 10 additions & 12 deletions disk_partition_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package tstorage

/*
import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestOpenDiskPartition(t *testing.T) {
tests := []struct {
name string
Expand All @@ -9,14 +14,9 @@ func TestOpenDiskPartition(t *testing.T) {
wantErr bool
}{
{
name: "existent dir given",
dirPath: "./testdata",
want: &diskPartition{
dirPath: "./testdata",
numPoints: 2,
minT: 1600000000,
maxT: 1600000001,
},
name: "empty dir name given",
dirPath: "",
wantErr: true,
},
{
name: "non-existent dir given",
Expand All @@ -26,11 +26,9 @@ func TestOpenDiskPartition(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := openDiskPartition(tt.dirPath, newGzipDecompressor)
got, err := openDiskPartition(tt.dirPath)
assert.Equal(t, tt.wantErr, err != nil)
assert.Equal(t, tt.want, got)
})
}
}
*/

0 comments on commit 3041d28

Please sign in to comment.