Skip to content

Commit

Permalink
rhp/v2: ignore windows error during test
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Aug 20, 2024
1 parent 03f26df commit 84e1439
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion rhp/v2/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net"
"path/filepath"
"reflect"
"runtime"
"testing"

crhp2 "go.sia.tech/core/rhp/v2"
Expand Down Expand Up @@ -487,8 +488,26 @@ func TestRPCV2(t *testing.T) {
node.Wallet.SignTransaction(&txn, toSign, wallet.ExplicitCoveredFields(txn))
formationSet := append(node.Chain.UnconfirmedParents(txn), txn)

if _, _, err := rpc2.RPCFormContract(transport, renterKey, formationSet); !errors.Is(err, rhp2.ErrV2Hardfork) {
_, _, err = rpc2.RPCFormContract(transport, renterKey, formationSet)
if runtime.GOOS != "windows" && !errors.Is(err, rhp2.ErrV2Hardfork) { // windows responds with wsarecv rather than the error
t.Fatalf("expected ErrV2Hardfork, got %v", err)
} else if runtime.GOOS == "windows" && err == nil {
t.Fatal("expected windows error, got nil")
}
})

t.Run("rpc after require height", func(t *testing.T) {
// mine until the require height
testutil.MineAndSync(t, node, node.Wallet.Address(), int(network.HardforkV2.RequireHeight-node.Chain.Tip().Height))

transport := dialHost(t, hostKey.PublicKey(), l.Addr().String())
defer transport.Close()

_, err := rpc2.RPCSettings(transport)
if runtime.GOOS != "windows" && !errors.Is(err, rhp2.ErrV2Hardfork) { // windows responds with wsarecv rather than the error
t.Fatalf("expected ErrV2Hardfork, got %v", err)
} else if runtime.GOOS == "windows" && err == nil {
t.Fatal("expected windows error, got nil")
}
})
}

0 comments on commit 84e1439

Please sign in to comment.