@@ -46,6 +46,23 @@ var _ = e2e.DescribeXChainSerial("[Virtuous Transfer Tx AVAX]", func() {
46
46
func () {
47
47
rpcEps := e2e .Env .URIs
48
48
49
+ // Waiting for ongoing blocks to have completed before starting this
50
+ // test avoids the case of a previous test having initiated block
51
+ // processing but not having completed it.
52
+ gomega .Eventually (func () bool {
53
+ allNodeMetrics , err := tests .GetMetricsForNodes (rpcEps , metricBlksProcessing )
54
+ gomega .Expect (err ).Should (gomega .BeNil ())
55
+ for _ , metrics := range allNodeMetrics {
56
+ if metrics [metricBlksProcessing ] > 0 {
57
+ return false
58
+ }
59
+ }
60
+ return true
61
+ }).
62
+ WithTimeout (e2e .DefaultTimeout ).
63
+ WithPolling (e2e .DefaultPollingInterval ).
64
+ Should (gomega .BeTrue (), "The cluster is generating ongoing blocks. Is this test being run in parallel?" )
65
+
49
66
allMetrics := []string {
50
67
metricBlksProcessing ,
51
68
metricBlksAccepted ,
@@ -93,20 +110,10 @@ var _ = e2e.DescribeXChainSerial("[Virtuous Transfer Tx AVAX]", func() {
93
110
)
94
111
}
95
112
96
- // URI -> "metric name" -> "metric value"
97
- metricsBeforeTx := make (map [string ]map [string ]float64 )
98
- for _ , u := range rpcEps {
99
- ep := u + "/ext/metrics"
100
-
101
- mm , err := tests .GetMetricsValue (ep , allMetrics ... )
102
- gomega .Expect (err ).Should (gomega .BeNil ())
103
- tests .Outf ("{{green}}metrics at %q:{{/}} %v\n " , ep , mm )
104
-
105
- if mm [metricBlksProcessing ] > 0 {
106
- ginkgo .Fail ("%s the cluster has already ongoing blocks. Is this test being run in parallel?" )
107
- }
108
-
109
- metricsBeforeTx [u ] = mm
113
+ metricsBeforeTx , err := tests .GetMetricsForNodes (rpcEps , allMetrics ... )
114
+ gomega .Expect (err ).Should (gomega .BeNil ())
115
+ for _ , uri := range rpcEps {
116
+ tests .Outf ("{{green}}metrics at %q:{{/}} %v\n " , uri , metricsBeforeTx [uri ])
110
117
}
111
118
112
119
testBalances := make ([]uint64 , 0 )
@@ -249,8 +256,7 @@ RECEIVER NEW BALANCE (AFTER) : %21d AVAX
249
256
gomega .Expect (err ).Should (gomega .BeNil ())
250
257
gomega .Expect (status ).Should (gomega .Equal (choices .Accepted ))
251
258
252
- ep := u + "/ext/metrics"
253
- mm , err := tests .GetMetricsValue (ep , allMetrics ... )
259
+ mm , err := tests .GetMetricsForNode (u , allMetrics ... )
254
260
gomega .Expect (err ).Should (gomega .BeNil ())
255
261
256
262
prev := metricsBeforeTx [u ]
0 commit comments