Skip to content

Commit

Permalink
test: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danijelTxFusion committed Dec 22, 2023
1 parent 167a0de commit 63a9fe5
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 249 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
delete-me
test/testfiles/token.json
test/token.json
33 changes: 0 additions & 33 deletions scripts/wait.go

This file was deleted.

26 changes: 26 additions & 0 deletions test/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"math/big"
"os"
"testing"
"time"
)

const TokenPath = "./token.json"
Expand Down Expand Up @@ -191,7 +192,32 @@ func createTokenL2(wallet *accounts.Wallet, client clients.Client, ethClient *et
return tokenL2Address, tx.Hash(), l2Tx.Hash
}

func wait() {
const maxAttempts = 30

nodeURL := "http://localhost:3050"
client, err := clients.Dial(nodeURL)
if err != nil {
log.Fatal(err)
}
defer client.Close()

for i := 0; i < maxAttempts; i++ {
_, err := client.NetworkID(context.Background())
if err == nil {
log.Println("Node is ready to receive traffic.")
return
}

log.Println("Node not ready yet. Retrying...")
time.Sleep(20 * time.Second)
}

log.Fatal("Maximum retries exceeded.")
}

func TestMain(m *testing.M) {
wait()

client, err := clients.Dial(ZkSyncEraProvider)
if err != nil {
Expand Down
Binary file added test/testfiles/Demo.zbin
Binary file not shown.
Binary file added test/testfiles/Foo.zbin
Binary file not shown.
Binary file added test/testfiles/Incrementer.zbin
Binary file not shown.
Binary file added test/testfiles/Storage.zbin
Binary file not shown.
Loading

0 comments on commit 63a9fe5

Please sign in to comment.