Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thiagodeev/rpcv08-websocket #651

Draft
wants to merge 13 commits into
base: v0.8.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/main_ci_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ jobs:
cd ../simpleCall && go build
cd ../simpleInvoke && go build
cd ../deployContractUDC && go build

# Test client on mock
- name: Test client with mocks
run: cd client && go test -v
16 changes: 4 additions & 12 deletions account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"flag"
"fmt"
"math/big"
"os"
"testing"
Expand All @@ -18,7 +17,6 @@ import (
"github.com/NethermindEth/starknet.go/mocks"
"github.com/NethermindEth/starknet.go/rpc"
"github.com/NethermindEth/starknet.go/utils"
"github.com/joho/godotenv"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
Expand All @@ -43,18 +41,12 @@ var (
//
// none
func TestMain(m *testing.M) {
flag.StringVar(&testEnv, "env", "mock", "set the test environment")
flag.StringVar(&testEnv, "env", "devnet", "set the test environment")
flag.Parse()
if testEnv == "mock" {
return
}
base = os.Getenv("INTEGRATION_BASE")
if base == "" {
if err := godotenv.Load(fmt.Sprintf(".env.%s", testEnv)); err != nil {
panic(fmt.Sprintf("Failed to load .env.%s, err: %s", testEnv, err))
}
base = os.Getenv("INTEGRATION_BASE")
}
base = "http://localhost:5050"
os.Exit(m.Run())
}

Expand Down Expand Up @@ -1076,7 +1068,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
Timeout: 3, // Should poll 3 times
Hash: new(felt.Felt).SetUint64(100),
ExpectedReceipt: rpc.TransactionReceipt{},
ExpectedErr: rpc.Err(rpc.InternalError, &rpc.RPCData{Message: "Post \"http://localhost:5050\": context deadline exceeded"}),
ExpectedErr: rpc.Err(rpc.InternalError, &rpc.RPCData{Message: "context deadline exceeded"}),
},
},
}[testEnv]
Expand All @@ -1090,7 +1082,7 @@ func TestWaitForTransactionReceipt(t *testing.T) {
rpcErr, ok := err.(*rpc.RPCError)
require.True(t, ok)
require.Equal(t, test.ExpectedErr.Code, rpcErr.Code)
require.Equal(t, test.ExpectedErr.Data.Message, rpcErr.Data.Message)
require.Contains(t, rpcErr.Data.Message, test.ExpectedErr.Data.Message) // sometimes the error message starts with "Post \"http://localhost:5050\":..."
} else {
require.Equal(t, test.ExpectedReceipt.ExecutionStatus, (*resp).ExecutionStatus)
}
Expand Down
Loading
Loading