mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
functional-tester/etcd-agent: configurable agent port
To make local testing easier.
This commit is contained in:
@@ -17,17 +17,20 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func main() {
|
||||
etcdPath := flag.String("etcd-path", "/opt/etcd/bin/etcd", "the path to etcd binary")
|
||||
etcdPath := flag.String("etcd-path", filepath.Join(os.Getenv("GOPATH"), "bin/etcd"), "the path to etcd binary")
|
||||
port := flag.String("port", ":9027", "port to serve agent server")
|
||||
flag.Parse()
|
||||
|
||||
a, err := newAgent(*etcdPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
a.serveRPC()
|
||||
a.serveRPC(*port)
|
||||
|
||||
var done chan struct{}
|
||||
<-done
|
||||
|
||||
@@ -23,14 +23,14 @@ import (
|
||||
"github.com/coreos/etcd/tools/functional-tester/etcd-agent/client"
|
||||
)
|
||||
|
||||
func (a *Agent) serveRPC() {
|
||||
func (a *Agent) serveRPC(port string) {
|
||||
rpc.Register(a)
|
||||
rpc.HandleHTTP()
|
||||
l, e := net.Listen("tcp", ":9027")
|
||||
l, e := net.Listen("tcp", port)
|
||||
if e != nil {
|
||||
log.Fatal("agent:", e)
|
||||
}
|
||||
log.Println("agent listening on :9027")
|
||||
log.Println("agent listening on", port)
|
||||
go http.Serve(l, nil)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user