Skip to content

Commit d2a5393

Browse files
add comments to highlight the use of wasip1 in the tests
Signed-off-by: Achille Roussel <[email protected]>
1 parent 908b362 commit d2a5393

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

grpc/grpc_wasip1_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ func (s *helloService) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.H
2323
}
2424

2525
func TestGRPC(t *testing.T) {
26+
// First create the listener that the gRPC server will be using to accept
27+
// connections using the wasip1 package instead of the standard net package
28+
// to use WASI socket extensions not available in Go 1.21.
2629
l, err := wasip1.Listen("tcp", ":0")
2730
if err != nil {
2831
t.Fatal(err)

ttrpc/ttrpc_wasip1_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ func TestTTRPC(t *testing.T) {
2828
ctx, cancel = context.WithDeadline(ctx, deadline)
2929
defer cancel()
3030
}
31-
31+
// First create the listener that the ttrpc server will be using to accept
32+
// connections using the wasip1 package instead of the standard net package
33+
// to use WASI socket extensions not available in Go 1.21.
3234
l, err := wasip1.Listen("tcp", ":0")
3335
if err != nil {
3436
t.Fatal(err)
@@ -47,7 +49,9 @@ func TestTTRPC(t *testing.T) {
4749
go func() {
4850
defer close(errs)
4951
defer server.Shutdown(ctx)
50-
52+
// Connect to the ttrpc server using the wasip1 dial function to
53+
// establish a connection using the WASI socket extensions not available
54+
// in Go 1.21.
5155
conn, err := wasip1.DialContext(ctx, "tcp", addr)
5256
if err != nil {
5357
errs <- err

0 commit comments

Comments
 (0)