Skip to content

Commit c8a9b02

Browse files
committed
fix integration test
1 parent 14eb2c4 commit c8a9b02

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

integration/tests/access/cohort3/collection_indexing_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cohort3
33
import (
44
"context"
55
"fmt"
6+
"net/http"
67
"testing"
78
"time"
89

@@ -82,7 +83,7 @@ func (s *CollectionIndexingSuite) Test() {
8283
// start the network with access_2 disconnected.
8384
// this simulates it falling behind on syncing collections
8485
access2 := s.net.ContainerByName("access_2")
85-
s.Require().NoError(access2.Disconnect())
86+
s.Require().NoError(access2.Pause())
8687

8788
// wait for access_1 to sync collections
8889
targetBlockCount := uint64(50)
@@ -98,7 +99,10 @@ func (s *CollectionIndexingSuite) Test() {
9899
s.Require().NoError(s.net.ContainerByName("collection_2").Pause())
99100

100101
// now start access_2, and wait for it to catch up with collections
101-
s.Require().NoError(access2.Connect())
102+
s.Require().NoError(access2.Start())
103+
104+
// wait for access_2 to complete startup
105+
s.waitForMetricsAPI("access_2")
102106

103107
s.Eventually(func() bool {
104108
value, err := s.getLastFullHeight("access_2")
@@ -118,3 +122,13 @@ func (s *CollectionIndexingSuite) getLastFullHeight(containerName string) (uint6
118122

119123
return uint64(values[0].GetGauge().GetValue()), nil
120124
}
125+
126+
func (s *CollectionIndexingSuite) waitForMetricsAPI(containerName string) {
127+
node := s.net.ContainerByName(containerName)
128+
metricsURL := fmt.Sprintf("http://0.0.0.0:%s/metrics", node.Port(testnet.MetricsPort))
129+
130+
s.Require().Eventually(func() bool {
131+
_, err := http.Get(metricsURL)
132+
return err == nil
133+
}, 60*time.Second, 1*time.Second)
134+
}

0 commit comments

Comments
 (0)