27 lines
468 B
Go
Executable File
27 lines
468 B
Go
Executable File
package consul
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/url"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewBuilder(t *testing.T) {
|
|
consul := fmt.Sprintf("consul://%s/%s?healthy=true", "127.0.0.1:8500", "test-s1")
|
|
consulURL, err := url.Parse(consul)
|
|
assert.Nil(t, err)
|
|
|
|
b, err := NewBuilder(*consulURL)
|
|
assert.Nil(t, err)
|
|
|
|
for i := 0; i < 10; i++ {
|
|
addrs := b.GetAddrTags()
|
|
log.Println(addrs)
|
|
time.Sleep(time.Duration(2) * time.Second)
|
|
}
|
|
}
|