Skip to content

Commit

Permalink
Fix #630
Browse files Browse the repository at this point in the history
  • Loading branch information
ymmt2005 committed Jan 8, 2024
1 parent fe93a9b commit 188bbfb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/v1beta2/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var _ = BeforeSuite(func() {

// wait for the webhook server to get ready
dialer := &net.Dialer{Timeout: time.Second}
addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort)
addrPort := net.JoinHostPort(webhookInstallOptions.LocalServingHost, fmt.Sprint(webhookInstallOptions.LocalServingPort))
Eventually(func() error {
conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true})
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/bkop/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bkop
import (
"context"
"fmt"
"net"
"os"
"os/exec"
"strings"
Expand All @@ -12,7 +13,7 @@ import (

func (o operator) DumpFull(ctx context.Context, dir string) error {
args := []string{
fmt.Sprintf("mysql://%s@%s:%d", o.user, o.host, o.port),
fmt.Sprintf("mysql://%s@%s", o.user, net.JoinHostPort(o.host, fmt.Sprint(o.port))),
"-p" + o.password,
"--save-passwords=never",
"-C", "False",
Expand Down
3 changes: 2 additions & 1 deletion pkg/bkop/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bkop
import (
"context"
"fmt"
"net"
"time"

"github.com/go-sql-driver/mysql"
Expand Down Expand Up @@ -62,7 +63,7 @@ func NewOperator(host string, port int, user, password string, threads int) (Ope
cfg.User = user
cfg.Passwd = password
cfg.Net = "tcp"
cfg.Addr = fmt.Sprintf("%s:%d", host, port)
cfg.Addr = net.JoinHostPort(host, fmt.Sprint(port))
cfg.InterpolateParams = true
cfg.ParseTime = true
cfg.Timeout = 5 * time.Second
Expand Down
3 changes: 2 additions & 1 deletion pkg/bkop/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bkop
import (
"context"
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
Expand All @@ -22,7 +23,7 @@ func (o operator) PrepareRestore(ctx context.Context) error {

func (o operator) LoadDump(ctx context.Context, dir string) error {
args := []string{
fmt.Sprintf("mysql://%s@%s:%d", o.user, o.host, o.port),
fmt.Sprintf("mysql://%s@%s", o.user, net.JoinHostPort(o.host, fmt.Sprint(o.port))),
"-p" + o.password,
"--save-passwords=never",
"-C", "False",
Expand Down

0 comments on commit 188bbfb

Please # to comment.