-
Notifications
You must be signed in to change notification settings - Fork 40
/
tracing_cli_test.go
33 lines (24 loc) · 1.04 KB
/
tracing_cli_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package seth_test
import (
"context"
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/smartcontractkit/chainlink-testing-framework/seth"
sethcmd "github.com/smartcontractkit/chainlink-testing-framework/seth/cmd"
)
func TestCLITracing(t *testing.T) {
c := newClientWithContractMapFromEnv(t)
SkipAnvil(t, c)
file, err := os.CreateTemp("", "reverted_transactions.json")
require.NoError(t, err, "should have created temp file")
tx, txErr := TestEnv.DebugContract.AlwaysRevertsCustomError(c.NewTXOpts())
require.NoError(t, txErr, "transaction should have reverted")
_, err = c.WaitMined(context.Background(), seth.L, c.Client, tx)
require.NoError(t, err, "should have waited for transaction to be mined")
err = seth.CreateOrAppendToJsonArray(file.Name(), tx.Hash().Hex())
require.NoError(t, err, "should have written to file")
_ = os.Setenv(seth.CONFIG_FILE_ENV_VAR, "seth.toml")
err = sethcmd.RunCLI([]string{"seth", "-n", "Geth", "trace", "-f", file.Name()})
require.NoError(t, err, "should have traced transactions")
}