Use new discover and useragent libs
This commit is contained in:
parent
5911fd5344
commit
303b56e07b
|
@ -6,6 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/hashicorp/consul/lib"
|
||||||
discover "github.com/hashicorp/go-discover"
|
discover "github.com/hashicorp/go-discover"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -67,7 +68,11 @@ func (r *retryJoiner) retryJoin() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
disco := discover.Discover{}
|
disco, err := discover.New(discover.WithUserAgent(lib.UserAgent()))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
r.logger.Printf("[INFO] agent: Retry join %s is supported for: %s", r.cluster, strings.Join(disco.Names(), " "))
|
r.logger.Printf("[INFO] agent: Retry join %s is supported for: %s", r.cluster, strings.Join(disco.Names(), " "))
|
||||||
r.logger.Printf("[INFO] agent: Joining %s cluster...", r.cluster)
|
r.logger.Printf("[INFO] agent: Joining %s cluster...", r.cluster)
|
||||||
attempt := 0
|
attempt := 0
|
||||||
|
|
|
@ -8,7 +8,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGoDiscoverRegistration(t *testing.T) {
|
func TestGoDiscoverRegistration(t *testing.T) {
|
||||||
d := discover.Discover{}
|
d, err := discover.New()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
got := d.Names()
|
got := d.Names()
|
||||||
want := []string{"aliyun", "aws", "azure", "digitalocean", "gce", "os", "scaleway", "softlayer", "triton"}
|
want := []string{"aliyun", "aws", "azure", "digitalocean", "gce", "os", "scaleway", "softlayer", "triton"}
|
||||||
if !reflect.DeepEqual(got, want) {
|
if !reflect.DeepEqual(got, want) {
|
||||||
|
|
Loading…
Reference in New Issue