Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zjg555543 committed Sep 12, 2024
1 parent 927db08 commit 7992d2f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
6 changes: 6 additions & 0 deletions test/e2e/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@ func TestMetrics(t *testing.T) {
require.NoError(t, err)
require.Equal(t, strings.Contains(result, "sequencer_batch_execute_time"), true)
require.Equal(t, strings.Contains(result, "sequencer_pool_tx_count"), true)

result, err = operations.GetMetrics()
require.NoError(t, err)
require.Equal(t, strings.Contains(result, "zkevm_getBatchWitness"), true)
require.Equal(t, strings.Contains(result, "eth_sendRawTransaction"), true)
require.Equal(t, strings.Contains(result, "eth_getTransactionCount"), true)
}

func transToken(t *testing.T, ctx context.Context, client *ethclient.Client, amount *uint256.Int, toAddress string) string {
Expand Down
8 changes: 5 additions & 3 deletions test/operations/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ const (
DefaultL1AdminAddress = "0x8f8E2d6cF621f30e9a11309D6A56A876281Fd534"
DefaultL1AdminPrivateKey = "0x815405dddb0e2a99b12af775fd2929e526704e1d1aea6a0b4e74dc33e2f7fcd2"

DefaultL2NetworkURL = "http://localhost:8124"
DefaultL2MetricsPrometheusURL = "http://127.0.0.1:9092/debug/metrics/prometheus"
DefaultL2ChainID uint64 = 195
DefaultL2NetworkURL = "http://localhost:8124"
DefaultL2ChainID uint64 = 195

DefaultL2MetricsPrometheusURL = "http://127.0.0.1:9092/debug/metrics/prometheus"
DefaultL2MetricsURL = "http://127.0.0.1:9092/debug/metrics"

BridgeAddr = "0x1089Af36bD72553008FAd0A1240B4D5641208494"

Expand Down
17 changes: 17 additions & 0 deletions test/operations/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,20 @@ func GetMetricsPrometheus() (string, error) {
}
return string(body), nil
}

func GetMetrics() (string, error) {
client := http.Client{
Timeout: 10 * time.Second,
}
resp, err := client.Get(DefaultL2MetricsURL)
if err != nil {
fmt.Println("Error:", err)
return "", err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
return string(body), nil
}

0 comments on commit 7992d2f

Please sign in to comment.