diff --git a/nats.go b/nats.go index 539c248..8a13db7 100644 --- a/nats.go +++ b/nats.go @@ -10,7 +10,7 @@ import ( "github.com/micro/go-micro/broker" "github.com/micro/go-micro/cmd" "github.com/micro/go-micro/codec/json" - nats "github.com/nats-io/go-nats" + nats "github.com/nats-io/nats.go" ) type nbroker struct { diff --git a/nats_test.go b/nats_test.go index beafcde..4dbd487 100644 --- a/nats_test.go +++ b/nats_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/micro/go-micro/broker" - "github.com/nats-io/go-nats" + nats "github.com/nats-io/nats.go" ) var addrTestCases = []struct { @@ -38,7 +38,9 @@ var addrTestCases = []struct { "default", "check if default Address is set correctly", map[string]string{ - "nats://localhost:4222": ""}, + "nats://localhost:4222": "", + "nats://127.0.0.1:4222": "", + }, }, } @@ -78,8 +80,10 @@ func TestInitAddrs(t *testing.T) { if !ok { t.Fatal("Expected broker to be of types *nbroker") } - // check if the same amount of addrs we set has actually been set - if len(natsBroker.addrs) != len(tc.addrs) { + // check if the same amount of addrs we set has actually been set, default + // have only 1 address nats://127.0.0.1:4222 (current nats code) or + // nats://localhost:4222 (older code version) + if len(natsBroker.addrs) != len(tc.addrs) && tc.name != "default" { t.Errorf("Expected Addr count = %d, Actual Addr count = %d", len(natsBroker.addrs), len(tc.addrs)) } diff --git a/options.go b/options.go index d942897..4743160 100644 --- a/options.go +++ b/options.go @@ -2,7 +2,7 @@ package nats import ( "github.com/micro/go-micro/broker" - nats "github.com/nats-io/go-nats" + nats "github.com/nats-io/nats.go" ) type optionsKey struct{}