Skip to content

Commit 981c853

Browse files
committed
whoops
Signed-off-by: Joshua Kim <[email protected]>
1 parent a8bcd6c commit 981c853

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ require (
3737
github.com/mr-tron/base58 v1.2.0
3838
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d
3939
github.com/onsi/ginkgo/v2 v2.13.1
40+
github.com/onsi/gomega v1.29.0
4041
github.com/pires/go-proxyproto v0.6.2
4142
github.com/prometheus/client_golang v1.16.0
4243
github.com/prometheus/client_model v0.3.0
@@ -81,7 +82,10 @@ require (
8182
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
8283
)
8384

84-
require github.com/ava-labs/firewood-go-ethhash/ffi v0.0.8 // indirect
85+
require (
86+
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.8 // indirect
87+
github.com/google/go-cmp v0.7.0 // indirect
88+
)
8589

8690
require (
8791
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect

tests/e2e/vms/xsvm.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import (
99
"fmt"
1010
"net"
1111
"net/http"
12-
"sync"
1312
"time"
1413

1514
"connectrpc.com/connect"
1615
"github.com/onsi/ginkgo/v2"
1716
"github.com/stretchr/testify/require"
1817
"go.uber.org/zap"
1918
"golang.org/x/net/http2"
19+
"golang.org/x/sync/errgroup"
2020

21-
"github.com/ava-labs/avalanchego/api/server"
21+
"github.com/ava-labs/avalanchego/api/connectclient"
2222
"github.com/ava-labs/avalanchego/connectproto/pb/xsvm"
2323
"github.com/ava-labs/avalanchego/connectproto/pb/xsvm/xsvmconnect"
2424
"github.com/ava-labs/avalanchego/ids"
@@ -211,28 +211,30 @@ var _ = ginkgo.Describe("[XSVM]", ginkgo.Label("xsvm"), func() {
211211
},
212212
}
213213

214-
client := xsvmconnect.NewPingClient(httpClient, node.URI)
214+
chainID := network.GetSubnet(subnetAName).Chains[0].ChainID.String()
215+
client := xsvmconnect.NewPingClient(
216+
httpClient,
217+
node.URI,
218+
connect.WithInterceptors(
219+
connectclient.SetRouteHeaderInterceptor{Route: chainID},
220+
),
221+
)
215222

216223
tc.By("serving unary rpc")
217224
msg := "foobar"
218-
219225
request := &connect.Request[xsvm.PingRequest]{
220226
Msg: &xsvm.PingRequest{
221227
Message: msg,
222228
},
223229
}
224230

225-
chainID := network.GetSubnet(subnetAName).Chains[0].ChainID
226-
request.Header().Set(server.HTTPHeaderRoute, chainID.String())
227-
228231
reply, err := client.Ping(tc.DefaultContext(), request)
229232
require.NoError(err)
230233
require.Equal(msg, reply.Msg.Message)
231234

232235
tc.By("serving bidirectional streaming rpc")
233236

234237
stream := client.StreamPing(tc.DefaultContext())
235-
stream.RequestHeader().Set(server.HTTPHeaderRoute, chainID.String())
236238
ginkgo.DeferCleanup(func() {
237239
require.NoError(stream.CloseRequest())
238240
})
@@ -260,8 +262,14 @@ var _ = ginkgo.Describe("[XSVM]", ginkgo.Label("xsvm"), func() {
260262
eg.Go(func() error {
261263
for i := 0; i < n; i++ {
262264
reply, err := stream.Receive()
263-
require.NoError(err)
264-
require.Equal(fmt.Sprintf("ping-%d", i), reply.Message)
265+
if err != nil {
266+
return err
267+
}
268+
269+
if fmt.Sprintf("ping-%d", i) != reply.Message {
270+
return fmt.Errorf("unexpected ping reply: %s", reply.Message)
271+
}
272+
265273
log.Info("received message", zap.String("msg", reply.Message))
266274
}
267275

0 commit comments

Comments
 (0)