Skip to content

Commit 790f93c

Browse files
craig[bot]rharding6373
andcommitted
Merge #144667
144667: tests: add retry to cdc msk auth roachtest r=rharding6373 a=rharding6373 This PR deflakes kafka-auth-msk by adding a retry loop to starting msk brokers. Epic: none Fixes: #143631 Release note: none Co-authored-by: rharding6373 <[email protected]>
2 parents 8f92259 + d36eaff commit 790f93c

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
@@ -3824,8 +3824,6 @@ rm -f go.mod go.sum
38243824
go mod init create-msk-topic
38253825
go mod tidy
38263826
go build .
3827-
3828-
./create-msk-topic --broker "$1" --topic "$2" --role-arn "$3"
38293827
`, createMSKTopicBinPath)
38303828

38313829
// CreateTopic creates a topic on the MSK cluster.
@@ -3835,8 +3833,21 @@ func (m *mskManager) CreateTopic(ctx context.Context, topic string, c cluster.Cl
38353833

38363834
require.NoError(m.t, c.RunE(ctx, withCTN, "mkdir", "-p", createMSKTopicBinPath))
38373835
require.NoError(m.t, c.PutString(ctx, createMskTopicMain, path.Join(createMSKTopicBinPath, "main.go"), 0700, createTopicNode))
3838-
require.NoError(m.t, c.PutString(ctx, setupMskTopicScript, path.Join(createMSKTopicBinPath, "run.sh"), 0700, createTopicNode))
3839-
require.NoError(m.t, c.RunE(ctx, withCTN, path.Join(createMSKTopicBinPath, "run.sh"), m.connectInfo.broker, topic, mskRoleArn))
3836+
require.NoError(m.t, c.PutString(ctx, setupMskTopicScript,
3837+
path.Join(createMSKTopicBinPath, "setup.sh"), 0700, createTopicNode))
3838+
require.NoError(m.t, c.RunE(ctx, withCTN,
3839+
path.Join(createMSKTopicBinPath, "setup.sh"), m.connectInfo.broker, topic, mskRoleArn))
3840+
retryOpts := retry.Options{
3841+
InitialBackoff: 1 * time.Minute,
3842+
MaxBackoff: 5 * time.Minute,
3843+
}
3844+
require.NoError(m.t, retry.WithMaxAttempts(ctx, retryOpts, 3,
3845+
func() error {
3846+
return c.RunE(ctx, withCTN,
3847+
path.Join(createMSKTopicBinPath, "create-msk-topic"),
3848+
"--broker", m.connectInfo.broker, "--topic", topic, "--role-arn", mskRoleArn)
3849+
3850+
}))
38403851
}
38413852

38423853
// TearDown deletes the MSK cluster.

0 commit comments

Comments
 (0)