Files
ociclient/copyctx_test.go

29 lines
510 B
Go

package repocli
import (
"github.com/stretchr/testify/require"
"bytes"
"context"
"fmt"
"math/rand"
"testing"
)
func TestCopy(t *testing.T) {
srcsize := 1024 + 145
srcdata := make([]byte, srcsize)
_, err := rand.Read(srcdata)
require.NoError(t, err)
src := bytes.NewReader(srcdata)
dst := bytes.NewBuffer(nil)
ctx := context.Background()
recsize, err := Copy(ctx, dst, src)
require.NoError(t, err)
fmt.Printf("Size: %d %d\n", recsize, srcsize)
require.Equal(t, int64(srcsize), recsize)
}