make CI happy

This commit is contained in:
Alex Grintsvayg 2018-08-15 21:19:38 -04:00
parent 75886211b1
commit 65df7bc627

View file

@ -3,7 +3,6 @@ package reflector
import ( import (
"crypto/rand" "crypto/rand"
"io" "io"
"math"
"strconv" "strconv"
"testing" "testing"
"time" "time"
@ -168,12 +167,14 @@ func TestServer_PartialUpload(t *testing.T) {
missing[i] = bits.Rand().String() missing[i] = bits.Rand().String()
} }
var st store.BlobStore st := store.BlobStore(&mockPartialStore{missing: missing})
st = &mockPartialStore{missing: missing}
if _, ok := st.(neededBlobChecker); !ok { if _, ok := st.(neededBlobChecker); !ok {
t.Fatal("mock does not implement the relevant interface") t.Fatal("mock does not implement the relevant interface")
} }
st.Put(sdHash, randBlob(10)) err = st.Put(sdHash, randBlob(10))
if err != nil {
t.Fatal(err)
}
srv := NewServer(st) srv := NewServer(st)
err = srv.Start("127.0.0.1:" + strconv.Itoa(port)) err = srv.Start("127.0.0.1:" + strconv.Itoa(port))
@ -225,15 +226,17 @@ func TestServer_PartialUpload(t *testing.T) {
} }
} }
func MakeRandStream(size int) ([]byte, [][]byte) { //func MakeRandStream(size int) ([]byte, [][]byte) {
blobs := make([][]byte, int(math.Ceil(float64(size)/maxBlobSize))) // blobs := make([][]byte, int(math.Ceil(float64(size)/maxBlobSize)))
for i := 0; i < len(blobs); i++ { // for i := 0; i < len(blobs); i++ {
blobs[i] = randBlob(int(math.Min(maxBlobSize, float64(size)))) // blobs[i] = randBlob(int(math.Min(maxBlobSize, float64(size))))
size -= maxBlobSize // size -= maxBlobSize
} // }
//
return nil, blobs // //TODO: create SD blob for the stream
} //
// return nil, blobs
//}
func randBlob(size int) []byte { func randBlob(size int) []byte {
//if size > maxBlobSize { //if size > maxBlobSize {