Merge pull request #799 from milosgajdos83/go1.13-fix-tests
Fix tests to make go-micro work on Go 1.13
This commit is contained in:
commit
9ec27392de
@ -12,13 +12,14 @@ var (
|
|||||||
dbpw = flag.String("database-password", "", "db pw")
|
dbpw = flag.String("database-password", "", "db pw")
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func initTestFlags() {
|
||||||
flag.Set("database-host", "localhost")
|
flag.Set("database-host", "localhost")
|
||||||
flag.Set("database-password", "some-password")
|
flag.Set("database-password", "some-password")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFlagsrc_Read(t *testing.T) {
|
func TestFlagsrc_Read(t *testing.T) {
|
||||||
|
initTestFlags()
|
||||||
source := NewSource()
|
source := NewSource()
|
||||||
c, err := source.Read()
|
c, err := source.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -46,6 +47,7 @@ func TestFlagsrc_Read(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFlagsrc_ReadAll(t *testing.T) {
|
func TestFlagsrc_ReadAll(t *testing.T) {
|
||||||
|
initTestFlags()
|
||||||
source := NewSource(IncludeUnset(true))
|
source := NewSource(IncludeUnset(true))
|
||||||
c, err := source.Read()
|
c, err := source.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
2
go.mod
2
go.mod
@ -53,8 +53,6 @@ require (
|
|||||||
github.com/miekg/dns v1.1.15 // indirect
|
github.com/miekg/dns v1.1.15 // indirect
|
||||||
github.com/mitchellh/gox v1.0.1 // indirect
|
github.com/mitchellh/gox v1.0.1 // indirect
|
||||||
github.com/mitchellh/hashstructure v1.0.0
|
github.com/mitchellh/hashstructure v1.0.0
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
||||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
|
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
|
||||||
github.com/nats-io/nats.go v1.8.1
|
github.com/nats-io/nats.go v1.8.1
|
||||||
github.com/nats-io/nkeys v0.1.0 // indirect
|
github.com/nats-io/nkeys v0.1.0 // indirect
|
||||||
|
@ -40,7 +40,7 @@ func TestGossipRegistryBroadcast(t *testing.T) {
|
|||||||
r1 := newRegistry(Config(mc1), Address("127.0.0.1:54321"))
|
r1 := newRegistry(Config(mc1), Address("127.0.0.1:54321"))
|
||||||
|
|
||||||
mc2 := newMemberlistConfig()
|
mc2 := newMemberlistConfig()
|
||||||
r2 := newRegistry(Config(mc2), Address("127.0.0.2:54321"), registry.Addrs("127.0.0.1:54321"))
|
r2 := newRegistry(Config(mc2), Address("127.0.0.1:54322"), registry.Addrs("127.0.0.1:54321"))
|
||||||
|
|
||||||
defer r1.(*gossipRegistry).Stop()
|
defer r1.(*gossipRegistry).Stop()
|
||||||
defer r2.(*gossipRegistry).Stop()
|
defer r2.(*gossipRegistry).Stop()
|
||||||
@ -100,7 +100,7 @@ func TestGossipRegistryRetry(t *testing.T) {
|
|||||||
r1 := newRegistry(Config(mc1), Address("127.0.0.1:54321"))
|
r1 := newRegistry(Config(mc1), Address("127.0.0.1:54321"))
|
||||||
|
|
||||||
mc2 := newMemberlistConfig()
|
mc2 := newMemberlistConfig()
|
||||||
r2 := newRegistry(Config(mc2), Address("127.0.0.2:54321"), registry.Addrs("127.0.0.1:54321"))
|
r2 := newRegistry(Config(mc2), Address("127.0.0.1:54322"), registry.Addrs("127.0.0.1:54321"))
|
||||||
|
|
||||||
defer r1.(*gossipRegistry).Stop()
|
defer r1.(*gossipRegistry).Stop()
|
||||||
defer r2.(*gossipRegistry).Stop()
|
defer r2.(*gossipRegistry).Stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user