Skip to content

Commit

Permalink
chore: calculate variable once
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya authored and danielhe4rt committed Dec 13, 2024
1 parent 01a4fef commit 4388885
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/scylladb/scylladb.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ func WithShardAwareness() testcontainers.CustomizeRequestOption {
// It will set the "alternator-port" parameter to the specified port.
// It will also set the "alternator-write-isolation" parameter to "always" as a command line argument to the container.
func WithAlternator(alternatorPort int) testcontainers.CustomizeRequestOption {
strPort := strconv.Itoa(alternatorPort)

return func(req *testcontainers.GenericContainerRequest) error {
setCommandFlag(req, "--alternator-port", strconv.Itoa(alternatorPort))
setCommandFlag(req, "--alternator-port", strPort)
setCommandFlag(req, "--alternator-write-isolation", "always")
req.ExposedPorts = append(req.ExposedPorts, strconv.Itoa(alternatorPort))
req.WaitingFor = wait.ForAll(req.WaitingFor, wait.ForListeningPort(nat.Port(strconv.Itoa(alternatorPort))))
req.ExposedPorts = append(req.ExposedPorts, strPort)
req.WaitingFor = wait.ForAll(req.WaitingFor, wait.ForListeningPort(nat.Port(strPort)))
return nil
}
}
Expand Down

0 comments on commit 4388885

Please sign in to comment.