Skip to content

Commit 8ce8f10

Browse files
aCombraycopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 894067253
1 parent 49a5bc1 commit 8ce8f10

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

  • src/devtools/mobileharness/shared/util/comm/dualconduit/conduit

src/devtools/mobileharness/shared/util/comm/dualconduit/conduit/pump_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,7 @@ func TestAcceptStream_MultipleStreams(t *testing.T) {
216216
go func(c net.Conn) {
217217
defer backendConnections.Done()
218218
defer c.Close()
219-
buf := make([]byte, 1024)
220-
for {
221-
n, err := c.Read(buf)
222-
if err != nil {
223-
return
224-
}
225-
c.Write(buf[:n]) // Echo back
226-
}
219+
io.Copy(c, c)
227220
}(conn)
228221
}
229222
}()
@@ -260,11 +253,13 @@ func TestAcceptStream_MultipleStreams(t *testing.T) {
260253
incoming[id] <- payload.New([]byte(msg), nil)
261254

262255
// Extract echoed data
263-
res, err := outgoing[id].BlockFirst(t.Context())
256+
res, err := outgoing[id].Take(1).BlockLast(t.Context())
264257
if err != nil {
265258
t.Errorf("Error reading from flux %d: %v", id, err)
259+
} else if res == nil {
260+
t.Errorf("Flux %d got nil, want %q", id, msg)
266261
} else if string(res.Data()) != msg {
267-
t.Errorf("Flux %d got %v, want %v", id, string(res.Data()), msg)
262+
t.Errorf("Flux %d got %q, want %q", id, string(res.Data()), msg)
268263
}
269264
}(i)
270265
}

0 commit comments

Comments
 (0)