Files
dolt/go/nbs/mmap_table_reader_test.go
Ben Kalman 03b7221c36 Use stretchr/testify not attic-labs/testify (#3677)
stretchr has fixed a bug with the -count flag. I could merge these
changes into attic-labs, but it's easier to just use strechr.

We forked stretchr a long time ago so that we didn't link in the HTTP
testing libraries into the noms binaries (because we were using d.Chk in
production code). The HTTP issue doesn't seem to happen anymore, even
though we're still using d.Chk.
2017-09-07 15:01:03 -07:00

38 lines
782 B
Go

// Copyright 2016 Attic Labs, Inc. All rights reserved.
// Licensed under the Apache License, version 2.0:
// http://www.apache.org/licenses/LICENSE-2.0
package nbs
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMmapTableReader(t *testing.T) {
assert := assert.New(t)
dir, err := ioutil.TempDir("", "")
assert.NoError(err)
defer os.RemoveAll(dir)
fc := newFDCache(1)
defer fc.Drop()
chunks := [][]byte{
[]byte("hello2"),
[]byte("goodbye2"),
[]byte("badbye2"),
}
tableData, h := buildTable(chunks)
err = ioutil.WriteFile(filepath.Join(dir, h.String()), tableData, 0666)
assert.NoError(err)
trc := newMmapTableReader(dir, h, uint32(len(chunks)), nil, fc)
assertChunksInReader(chunks, trc, assert)
}