MCPcopy
hub / github.com/uber/aresdb / TestFileTransfer

Function TestFileTransfer

datanode/bootstrap/bootstrap_server_bm_test.go:33–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31)
32
33func TestFileTransfer(t *testing.T) {
34 testFile := "/tmp/file32k"
35 bigBuff := make([]byte, 32*1024)
36 ioutil.WriteFile(testFile, bigBuff, 0666)
37
38 metaStore := &metaMocks.MetaStore{}
39 diskStore := &diskMocks.DiskStore{}
40 grpcServer := grpc.NewServer()
41 peerServer := NewPeerDataNodeServer(metaStore, diskStore)
42 pb.RegisterPeerDataNodeServer(grpcServer, peerServer)
43
44 lis, err := net.Listen("tcp", fmt.Sprintf(":%d", 0))
45 if err != nil {
46 t.Error(err)
47 }
48 go grpcServer.Serve(lis)
49 defer grpcServer.Stop()
50
51 err = fileTransfer("testFileTransfer", lis.Addr().String(), testFile, 0, 0, 32*1024)
52 if err != nil {
53 t.Error(err)
54 }
55
56 os.Remove(testFile)
57}
58
59func fileTransfer(testName string, addr string, fileName string, chunkSize, bufferSize int32, expectedSize int) error {
60 conn, err := grpc.Dial(addr, grpc.WithInsecure())

Callers

nothing calls this directly

Calls 7

NewPeerDataNodeServerFunction · 0.85
fileTransferFunction · 0.85
ErrorMethod · 0.65
ServeMethod · 0.65
StopMethod · 0.65
StringMethod · 0.65
RemoveMethod · 0.65

Tested by

no test coverage detected