Skip to content

Commit

Permalink
fix test pkg and rename to devnet
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Sep 26, 2023
1 parent d0f67f0 commit ba01754
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 38 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test_devnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: rpc

on:
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
build:
runs-on: ubuntu-22.04

services:
devnet:
image: shardlabs/starknet-devnet:latest
ports:
- 5050:5050

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: wait for devnet to be up...
run: ./.bin/devnet.sh

# Test devnet pkg
- name: Test devnet on devnet
run: cd devnet && go test -timeout 600s -v .
2 changes: 1 addition & 1 deletion contracts/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/NethermindEth/juno/core/felt"
starknetgo "github.com/NethermindEth/starknet.go"
"github.com/NethermindEth/starknet.go/artifacts"
devtest "github.com/NethermindEth/starknet.go/test"
devtest "github.com/NethermindEth/starknet.go/devnet"
"github.com/NethermindEth/starknet.go/types"
"github.com/NethermindEth/starknet.go/utils"
"github.com/joho/godotenv"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/devnet_test.go → devnet/devnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestDevnet_FeeToken(t *testing.T) {
if err != nil {
t.Fatalf("Reading token should succeed, instead: %v", err)
}
if token.Address.String() != "0x062230ea046a9a5fbc261ac77d03c8d41e5d442db2284587570ab46455fd2488" {
if token.Address.String() != DevNetETHAddress {
t.Fatalf("devnet ETH address, instead %s", token.Address.String())
}
}
Expand Down
28 changes: 28 additions & 0 deletions devnet/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package test

import (
"flag"
"os"
"testing"
)

const (
DevNetETHAddress = "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
)

// testConfiguration is a type that is used to configure tests
type testConfiguration struct {
base string
}

var (
// set the environment for the test, default: devnet
testEnv = "devnet"
)

// TestMain is used to trigger the tests and, in that case, check for the environment to use.
func TestMain(m *testing.M) {
flag.StringVar(&testEnv, "env", "devnet", "set the test environment")
flag.Parse()
os.Exit(m.Run())
}
2 changes: 1 addition & 1 deletion gateway/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"testing"

starknetgo "github.com/NethermindEth/starknet.go"
test "github.com/NethermindEth/starknet.go/devnet"
"github.com/NethermindEth/starknet.go/gateway"
"github.com/NethermindEth/starknet.go/rpc"
"github.com/NethermindEth/starknet.go/test"
"github.com/NethermindEth/starknet.go/types"
"github.com/NethermindEth/starknet.go/utils"
"github.com/joho/godotenv"
Expand Down
2 changes: 1 addition & 1 deletion gateway/starknet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/starknet.go/artifacts"
devtest "github.com/NethermindEth/starknet.go/devnet"
"github.com/NethermindEth/starknet.go/gateway"
"github.com/NethermindEth/starknet.go/rpc"
devtest "github.com/NethermindEth/starknet.go/test"
"github.com/NethermindEth/starknet.go/types"
"github.com/NethermindEth/starknet.go/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion providers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (

"github.com/NethermindEth/juno/core/felt"
"github.com/NethermindEth/starknet.go/artifacts"
devtest "github.com/NethermindEth/starknet.go/devnet"
"github.com/NethermindEth/starknet.go/gateway"
"github.com/NethermindEth/starknet.go/rpc"
devtest "github.com/NethermindEth/starknet.go/test"
"github.com/NethermindEth/starknet.go/types"
ethrpc "github.com/ethereum/go-ethereum/rpc"
"github.com/joho/godotenv"
Expand Down
33 changes: 0 additions & 33 deletions test/main_test.go

This file was deleted.

0 comments on commit ba01754

Please sign in to comment.