Use new consul test server functions

This commit is contained in:
Marius 2017-04-12 12:11:11 +02:00
parent 377aee0562
commit 535e0dff59
1 changed files with 11 additions and 5 deletions

View File

@ -14,12 +14,15 @@ import (
func TestConsulLocker(t *testing.T) { func TestConsulLocker(t *testing.T) {
a := assert.New(t) a := assert.New(t)
server := consultestutil.NewTestServer(t) server, err := consultestutil.NewTestServer()
if err != nil {
t.Fatal(err)
}
defer server.Stop() defer server.Stop()
client, err := consul.NewClient(&consul.Config{ conf := consul.DefaultConfig()
Address: server.HTTPAddr, conf.Address = server.HTTPAddr
}) client, err := consul.NewClient(conf)
a.NoError(err) a.NoError(err)
locker := New(client) locker := New(client)
@ -38,7 +41,10 @@ func TestLockLost(t *testing.T) {
a := assert.New(t) a := assert.New(t)
server := consultestutil.NewTestServer(t) server, err := consultestutil.NewTestServer()
if err != nil {
t.Fatal(err)
}
client, err := consul.NewClient(&consul.Config{ client, err := consul.NewClient(&consul.Config{
Address: server.HTTPAddr, Address: server.HTTPAddr,