/
storage_test.go
41 lines (34 loc) · 775 Bytes
/
storage_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package blockstorage
import (
"bytes"
"crypto/rand"
"io"
"testing"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
type blockStorageSuite struct {
suite.Suite
*require.Assertions
ctrl *gomock.Controller
}
func generateRandomByteReader(t *testing.T, size int) io.Reader {
if size == 0 {
return bytes.NewReader([]byte{})
}
blk := make([]byte, size)
_, err := rand.Read(blk)
require.NoError(t, err)
return bytes.NewReader(blk)
}
func TestBlockStorageSuite(t *testing.T) {
suite.Run(t, new(blockStorageSuite))
}
func (s *blockStorageSuite) SetupTest() {
s.Assertions = require.New(s.T())
s.ctrl = gomock.NewController(s.T())
}
func (s *blockStorageSuite) TearDownTest() {
s.ctrl.Finish()
}