Skip to content

Commit

Permalink
Trigger Shutdown() method in capability tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Sep 15, 2024
1 parent 91efbbf commit 3a18c16
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions system/socket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ func TestPipeReader(t *testing.T) {

buf := strings.NewReader("test")
pipe := system.NewReadPipe(buf)
defer pipe.Release()

r := system.Socket{}.Connect(context.TODO(), pipe)
b, err := io.ReadAll(r)
require.NoError(t, err)
Expand All @@ -28,6 +30,8 @@ func TestPipeWriter(t *testing.T) {

buf := new(bytes.Buffer)
pipe := system.NewWritePipe(nopCloser{Writer: buf})
defer pipe.Release()

wc := system.Socket{}.Bind(context.TODO(), pipe)
n, err := io.Copy(wc, strings.NewReader("test"))
require.NoError(t, err)
Expand All @@ -40,6 +44,8 @@ func TestReadPipe(t *testing.T) {
t.Parallel()

pipe := system.NewReadPipe(strings.NewReader("test"))
defer pipe.Release()

f, release := pipe.Read(context.TODO(), func(read auth.ReadPipe_read_Params) error {
read.SetSize(int64(len("test")))
return nil
Expand Down Expand Up @@ -69,6 +75,8 @@ func TestWritePipe(t *testing.T) {

buf := new(bytes.Buffer)
pipe := system.NewWritePipe(nopCloser{Writer: buf})
defer pipe.Release()

f, release := pipe.Write(context.TODO(), func(write auth.WritePipe_write_Params) error {
return write.SetData([]byte("test"))
})
Expand Down

0 comments on commit 3a18c16

Please sign in to comment.