예제 #1
0
func Test_Transport_CreateUpload(t *testing.T) {
	root := "DeclareUpload"

	halt, tree, ml, _, tr := seed(t, root)
	defer halt()

	mx, err := ml.FeedManifests(true, true, true, lists.NewFileList().ListDir(tree.CWD)...)
	assert.NoError(t, err)

	upload := transport.NewUpload(tr, time.Hour)

	toUp, err := upload.SendCreateUpload(mx)
	assert.NoError(t, err)
	assert.Len(t, toUp, 4)
}
예제 #2
0
func Test_Transport_UploadChunk(t *testing.T) {
	root := "UploadChunk"

	halt, tree, ml, _, tr := seed(t, root)
	defer halt()

	mx, err := ml.FeedManifests(true, true, true, lists.NewFileList().ListDir(tree.CWD)...)
	assert.NoError(t, err)

	upload := transport.NewUpload(tr, time.Hour)

	missing, err := upload.SendCreateUpload(mx)
	assert.NoError(t, err)

	toUp := mx.GetChunkLinkSlice(missing)
	for _, tu := range toUp {
		err = upload.UploadChunk(tu.Name, tu.Chunk)
		assert.NoError(t, err)
	}
}