feat: Add function that writes to a file without expanding the buffer and closes the file.

This commit is contained in:
Elim Tsiagbey committed 2024-01-11 09:58:32 -05:00
1 parent 366128f079
commit cae97fcd2e
12 files changed
+253 -34

No files matched your search

+4 -2
View File
@@ -14,6 +14,7 @@ import (
"github.com/hashicorp/boundary/internal/bsr"
sshv1 "github.com/hashicorp/boundary/internal/bsr/gen/ssh/v1"
"github.com/hashicorp/boundary/internal/bsr/internal/fstest"
"github.com/hashicorp/boundary/internal/bsr/ssh"
"github.com/stretchr/testify/require"
)
@@ -31,9 +32,10 @@ func Test_sshChannelToAsciicast(t *testing.T) {
return f
}
newScanner := func(chunks ...bsr.Chunk) *bsr.ChunkScanner {
var buf bytes.Buffer
buf, err := fstest.NewTempBuffer()
require.NoError(t, err)
buf.Write(bsr.Magic.Bytes())
enc, err := bsr.NewChunkEncoder(ctx, &buf, bsr.NoCompression, bsr.NoEncryption)
enc, err := bsr.NewChunkEncoder(ctx, buf, bsr.NoCompression, bsr.NoEncryption)
require.NoError(t, err)
for _, c := range chunks {