Skip to content

Commit d36eaff

Browse files
committed
tests: add retry to cdc msk auth roachtest
This PR deflakes kafka-auth-msk by adding a retry loop to starting msk brokers. Epic: none Fixes: #143631 Release note: none
1 parent 30bcd20 commit d36eaff

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

pkg/cmd/roachtest/tests/cdc.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3818,8 +3818,6 @@ rm -f go.mod go.sum
38183818
go mod init create-msk-topic
38193819
go mod tidy
38203820
go build .
3821-
3822-
./create-msk-topic --broker "$1" --topic "$2" --role-arn "$3"
38233821
`, createMSKTopicBinPath)
38243822

38253823
// CreateTopic creates a topic on the MSK cluster.
@@ -3829,8 +3827,21 @@ func (m *mskManager) CreateTopic(ctx context.Context, topic string, c cluster.Cl
38293827

38303828
require.NoError(m.t, c.RunE(ctx, withCTN, "mkdir", "-p", createMSKTopicBinPath))
38313829
require.NoError(m.t, c.PutString(ctx, createMskTopicMain, path.Join(createMSKTopicBinPath, "main.go"), 0700, createTopicNode))
3832-
require.NoError(m.t, c.PutString(ctx, setupMskTopicScript, path.Join(createMSKTopicBinPath, "run.sh"), 0700, createTopicNode))
3833-
require.NoError(m.t, c.RunE(ctx, withCTN, path.Join(createMSKTopicBinPath, "run.sh"), m.connectInfo.broker, topic, mskRoleArn))
3830+
require.NoError(m.t, c.PutString(ctx, setupMskTopicScript,
3831+
path.Join(createMSKTopicBinPath, "setup.sh"), 0700, createTopicNode))
3832+
require.NoError(m.t, c.RunE(ctx, withCTN,
3833+
path.Join(createMSKTopicBinPath, "setup.sh"), m.connectInfo.broker, topic, mskRoleArn))
3834+
retryOpts := retry.Options{
3835+
InitialBackoff: 1 * time.Minute,
3836+
MaxBackoff: 5 * time.Minute,
3837+
}
3838+
require.NoError(m.t, retry.WithMaxAttempts(ctx, retryOpts, 3,
3839+
func() error {
3840+
return c.RunE(ctx, withCTN,
3841+
path.Join(createMSKTopicBinPath, "create-msk-topic"),
3842+
"--broker", m.connectInfo.broker, "--topic", topic, "--role-arn", mskRoleArn)
3843+
3844+
}))
38343845
}
38353846

38363847
// TearDown deletes the MSK cluster.

0 commit comments

Comments
 (0)