diff --git a/go/cmd/vttestserver/main.go b/go/cmd/vttestserver/main.go index 65614d80ace..55052b1b603 100644 --- a/go/cmd/vttestserver/main.go +++ b/go/cmd/vttestserver/main.go @@ -152,6 +152,8 @@ func parseFlags() (config vttest.Config, env vttest.Environment, err error) { flag.StringVar(&config.TransactionMode, "transaction_mode", "MULTI", "Transaction mode MULTI (default), SINGLE or TWOPC ") flag.Float64Var(&config.TransactionTimeout, "queryserver-config-transaction-timeout", 0, "query server transaction timeout (in seconds), a transaction will be killed if it takes longer than this value") + flag.StringVar(&config.TabletHostName, "tablet_hostname", "localhost", "The hostname to use for the tablet otherwise it will be derived from OS' hostname") + flag.Parse() if basePort != 0 { diff --git a/go/vt/vttest/local_cluster.go b/go/vt/vttest/local_cluster.go index 7e3fa92a2dd..2923ceaf461 100644 --- a/go/vt/vttest/local_cluster.go +++ b/go/vt/vttest/local_cluster.go @@ -101,6 +101,9 @@ type Config struct { TransactionMode string TransactionTimeout float64 + + // The host name to use for the table otherwise it will be resolved from the local hostname + TabletHostName string } // InitSchemas is a shortcut for tests that just want to setup a single diff --git a/go/vt/vttest/vtprocess.go b/go/vt/vttest/vtprocess.go index 91bf375a595..4a544798d4e 100644 --- a/go/vt/vttest/vtprocess.go +++ b/go/vt/vttest/vtprocess.go @@ -240,6 +240,9 @@ func VtcomboProcess(env Environment, args *Config, mysql MySQLManager) *VtProces if args.TransactionTimeout != 0 { vt.ExtraArgs = append(vt.ExtraArgs, "-queryserver-config-transaction-timeout", fmt.Sprintf("%f", args.TransactionTimeout)) } + if args.TabletHostName != "" { + vt.ExtraArgs = append(vt.ExtraArgs, []string{"-tablet_hostname", args.TabletHostName}...) + } if socket != "" { vt.ExtraArgs = append(vt.ExtraArgs, []string{