@@ -12,11 +12,14 @@ import (
12
12
"os"
13
13
"path"
14
14
"path/filepath"
15
+ "time"
15
16
16
17
"github.com/cockroachdb/cockroach/pkg/cloud/amazon"
17
18
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
18
19
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
19
20
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
21
+ "github.com/cockroachdb/cockroach/pkg/roachprod/install"
22
+ "github.com/cockroachdb/cockroach/pkg/util/retry"
20
23
)
21
24
22
25
// cephDisksScript creates 3 4GB loop devices, e.g. virtual block devices that allows
@@ -126,7 +129,9 @@ func (m cephManager) install(ctx context.Context) {
126
129
rgwCmd = rgwCmd + ` --ssl-certificate="$(base64 -w0 certs/node.crt)" --ssl-private-key="$(base64 -w0 certs/node.key)"`
127
130
}
128
131
m .run (ctx , `starting object gateway` , rgwCmd )
129
-
132
+ // We have seen occasional failures in creating users, so we
133
+ // wait until a read only request succeeds before proceeding.
134
+ m .checkRGW (ctx )
130
135
m .run (ctx , `creating backup user` ,
131
136
`sudo radosgw-admin user create --uid=backup --display-name=backup` )
132
137
m .run (ctx , `add keys to the user` ,
@@ -190,3 +195,20 @@ func (m cephManager) run(ctx context.Context, msg string, cmd ...string) {
190
195
m .c .Run (ctx , option .WithNodes (m .cephNodes ), cmd ... )
191
196
m .t .Status (msg , " done" )
192
197
}
198
+
199
+ // checkRGW verifies that the Ceph Object Gateway is up.
200
+ func (m cephManager ) checkRGW (ctx context.Context ) {
201
+ m .t .Status ("waiting for Ceph Object Gateway..." )
202
+ if err := m .c .RunE (ctx ,
203
+ option .WithNodes (m .cephNodes ).
204
+ WithRetryOpts (retry.Options {
205
+ InitialBackoff : 2 * time .Second ,
206
+ MaxBackoff : 30 * time .Second ,
207
+ MaxRetries : 10 ,
208
+ }).
209
+ WithShouldRetryFn (func (* install.RunResultDetails ) bool { return true }),
210
+ `sudo radosgw-admin user list` ,
211
+ ); err != nil {
212
+ m .t .Error ("failed to connect to Ceph Object Gateway" , err )
213
+ }
214
+ }
0 commit comments