Skip to content

Commit 5c5db64

Browse files
Merge d598226 into blathers/backport-release-25.1-148756
2 parents 3f389eb + d598226 commit 5c5db64

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

pkg/cmd/roachtest/tests/s3_microceph.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ import (
1212
"os"
1313
"path"
1414
"path/filepath"
15+
"time"
1516

1617
"github.com/cockroachdb/cockroach/pkg/cloud/amazon"
1718
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
1819
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
1920
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
21+
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
22+
"github.com/cockroachdb/cockroach/pkg/util/retry"
2023
)
2124

2225
// cephDisksScript creates 3 4GB loop devices, e.g. virtual block devices that allows
@@ -126,7 +129,9 @@ func (m cephManager) install(ctx context.Context) {
126129
rgwCmd = rgwCmd + ` --ssl-certificate="$(base64 -w0 certs/node.crt)" --ssl-private-key="$(base64 -w0 certs/node.key)"`
127130
}
128131
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)
130135
m.run(ctx, `creating backup user`,
131136
`sudo radosgw-admin user create --uid=backup --display-name=backup`)
132137
m.run(ctx, `add keys to the user`,
@@ -190,3 +195,20 @@ func (m cephManager) run(ctx context.Context, msg string, cmd ...string) {
190195
m.c.Run(ctx, option.WithNodes(m.cephNodes), cmd...)
191196
m.t.Status(msg, " done")
192197
}
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

Comments
 (0)