This commit is contained in:
Manfred Touron
2017-05-18 18:54:23 +02:00
parent dc386661ca
commit 5448f25fd6
645 changed files with 55908 additions and 33297 deletions

View File

@@ -4,7 +4,8 @@ package zk
import (
"bytes"
"log"
"flag"
"fmt"
"os"
"testing"
"time"
@@ -17,11 +18,21 @@ var (
)
func TestMain(m *testing.M) {
zkAddr := os.Getenv("ZK_ADDR")
if zkAddr == "" {
log.Fatal("ZK_ADDR is not set")
flag.Parse()
fmt.Println("Starting ZooKeeper server...")
ts, err := stdzk.StartTestCluster(1, nil, nil)
if err != nil {
fmt.Printf("ZooKeeper server error: %v\n", err)
os.Exit(1)
}
host = []string{zkAddr}
host = []string{fmt.Sprintf("localhost:%d", ts.Servers[0].Port)}
code := m.Run()
ts.Stop()
os.Exit(code)
}
func TestCreateParentNodesOnServer(t *testing.T) {

View File

@@ -24,7 +24,7 @@ func NewRegistrar(client Client, service Service, logger log.Logger) *Registrar
return &Registrar{
client: client,
service: service,
logger: log.With(logger,
logger: log.NewContext(logger).With(
"service", service.Name,
"path", service.Path,
"data", string(service.Data),

View File

@@ -1,7 +1,6 @@
package zk
import (
"context"
"errors"
"fmt"
"io"
@@ -9,6 +8,7 @@ import (
"time"
"github.com/samuel/go-zookeeper/zk"
"golang.org/x/net/context"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/kit/log"