Skip to content

Commit 7302af0

Browse files
authored
Merge pull request #107 from cockroachdb/fix-testserver-proxy-update
testserver: fix updated proxy arguments
2 parents 4f590c1 + dd87247 commit 7302af0

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

testserver/tenant.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ import (
1818
"database/sql"
1919
"errors"
2020
"fmt"
21+
"log"
2122
"net"
2223
"net/url"
2324
"os/exec"
2425
"path/filepath"
2526
"strconv"
27+
"strings"
2628
)
2729

2830
func (ts *testServerImpl) isTenant() bool {
@@ -144,17 +146,22 @@ func (ts *testServerImpl) NewTenantServer(proxy bool) (TestServer, error) {
144146
"start-proxy",
145147
"--listen-addr",
146148
ts.proxyAddr,
147-
"--target-addr",
149+
"--routing-rule",
148150
sqlAddr,
149151
"--listen-cert",
150152
filepath.Join(certsDir, "node.crt"),
151153
"--listen-key",
152154
filepath.Join(certsDir, "node.key"),
155+
"--listen-metrics=:0",
156+
"--skip-verify",
153157
}
154158
cmd := exec.Command(cockroachBinary, args...)
155159
if err := cmd.Start(); err != nil {
156160
return "", err
157161
}
162+
if cmd.Process != nil {
163+
log.Printf("process %d started: %s", cmd.Process.Pid, strings.Join(args, " "))
164+
}
158165
ts.proxyProcess = cmd.Process
159166

160167
return ts.proxyAddr, nil
@@ -172,6 +179,7 @@ func (ts *testServerImpl) NewTenantServer(proxy bool) (TestServer, error) {
172179
fmt.Sprintf("--tenant-id=%d", tenantID),
173180
"--kv-addrs=" + pgURL.Host,
174181
"--sql-addr=" + sqlAddr,
182+
"--http-addr=:0",
175183
}
176184

177185
tenant := &testServerImpl{
@@ -227,7 +235,7 @@ func (ts *testServerImpl) NewTenantServer(proxy bool) (TestServer, error) {
227235
tenantURL.Host = proxyAddr
228236
// Massage the query string. The proxy expects the magic cluster name 'prancing-pony'. We remove the client
229237
// certs since we won't be using them (and they don't work through the proxy anyway).
230-
v.Add("options", "--cluster=prancing-pony")
238+
v.Add("options", "--cluster=prancing-pony-2")
231239
}
232240

233241
// Client certs should not be used; we're using password auth.

testserver/testserver.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,10 @@ func (ts *testServerImpl) Start() error {
439439
ts.mu.Unlock()
440440

441441
ts.cmd = exec.Command(ts.cmdArgs[0], ts.cmdArgs[1:]...)
442-
ts.cmd.Env = []string{"COCKROACH_MAX_OFFSET=1ns"}
442+
ts.cmd.Env = []string{
443+
"COCKROACH_MAX_OFFSET=1ns",
444+
"COCKROACH_TRUST_CLIENT_PROVIDED_SQL_REMOTE_ADDR=true",
445+
}
443446

444447
if len(ts.stdout) > 0 {
445448
wr, err := newFileLogWriter(ts.stdout)

0 commit comments

Comments
 (0)