@@ -3824,8 +3824,6 @@ rm -f go.mod go.sum
38243824go mod init create-msk-topic
38253825go mod tidy
38263826go 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