Merge branch 'master' of ssh://github.com/micro/go-micro
This commit is contained in:
commit
6b1eef5354
2
go.mod
2
go.mod
@ -34,7 +34,7 @@ require (
|
|||||||
github.com/miekg/dns v1.1.22
|
github.com/miekg/dns v1.1.22
|
||||||
github.com/mitchellh/hashstructure v1.0.0
|
github.com/mitchellh/hashstructure v1.0.0
|
||||||
github.com/nats-io/nats.go v1.9.1
|
github.com/nats-io/nats.go v1.9.1
|
||||||
github.com/nlopes/slack v0.6.0
|
github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249 // indirect
|
||||||
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c
|
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c
|
||||||
github.com/pkg/errors v0.8.1
|
github.com/pkg/errors v0.8.1
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
|
2
go.sum
2
go.sum
@ -294,6 +294,8 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
|
|||||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||||
github.com/nlopes/slack v0.6.0 h1:jt0jxVQGhssx1Ib7naAOZEZcGdtIhTzkP0nopK0AsRA=
|
github.com/nlopes/slack v0.6.0 h1:jt0jxVQGhssx1Ib7naAOZEZcGdtIhTzkP0nopK0AsRA=
|
||||||
github.com/nlopes/slack v0.6.0/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk=
|
github.com/nlopes/slack v0.6.0/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk=
|
||||||
|
github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249 h1:Pr5gZa2VcmktVwq0lyC39MsN5tz356vC/pQHKvq+QBo=
|
||||||
|
github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk=
|
||||||
github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw=
|
github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw=
|
||||||
github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2SwKQ=
|
github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2SwKQ=
|
||||||
github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw=
|
github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw=
|
||||||
|
@ -57,10 +57,10 @@ func TestService(t *testing.T) {
|
|||||||
|
|
||||||
service.HandleFunc("/", fn)
|
service.HandleFunc("/", fn)
|
||||||
|
|
||||||
|
errCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
if err := service.Run(); err != nil {
|
errCh <- service.Run()
|
||||||
t.Fatal(err)
|
close(errCh)
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var s []*registry.Service
|
var s []*registry.Service
|
||||||
@ -104,12 +104,32 @@ func TestService(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
case err := <-errCh:
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("service.Run():%v", err)
|
||||||
|
}
|
||||||
|
case <-time.After(time.Duration(time.Second)):
|
||||||
|
t.Logf("service.Run() survived a client request without an error")
|
||||||
|
}
|
||||||
|
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, syscall.SIGTERM)
|
signal.Notify(ch, syscall.SIGTERM)
|
||||||
|
|
||||||
syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
|
||||||
<-ch
|
<-ch
|
||||||
|
|
||||||
|
select {
|
||||||
|
case err := <-errCh:
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("service.Run():%v", err)
|
||||||
|
} else {
|
||||||
|
t.Log("service.Run() nil return on syscall.SIGTERM")
|
||||||
|
}
|
||||||
|
case <-time.After(time.Duration(time.Second)):
|
||||||
|
t.Logf("service.Run() survived a client request without an error")
|
||||||
|
}
|
||||||
|
|
||||||
eventually(func() bool {
|
eventually(func() bool {
|
||||||
_, err := reg.GetService("go.micro.web.test")
|
_, err := reg.GetService("go.micro.web.test")
|
||||||
return err == registry.ErrNotFound
|
return err == registry.ErrNotFound
|
||||||
@ -128,6 +148,7 @@ func TestService(t *testing.T) {
|
|||||||
t.Errorf("unexpected %s: want true, have false", tt.subject)
|
t.Errorf("unexpected %s: want true, have false", tt.subject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOptions(t *testing.T) {
|
func TestOptions(t *testing.T) {
|
||||||
@ -221,10 +242,10 @@ func TestTLS(t *testing.T) {
|
|||||||
|
|
||||||
service.HandleFunc("/", fn)
|
service.HandleFunc("/", fn)
|
||||||
|
|
||||||
|
errCh := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
if err := service.Run(); err != nil {
|
errCh <- service.Run()
|
||||||
t.Fatal(err)
|
close(errCh)
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var s []*registry.Service
|
var s []*registry.Service
|
||||||
@ -257,4 +278,14 @@ func TestTLS(t *testing.T) {
|
|||||||
if string(b) != str {
|
if string(b) != str {
|
||||||
t.Errorf("Expected %s got %s", str, string(b))
|
t.Errorf("Expected %s got %s", str, string(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
case err := <-errCh:
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("service.Run():%v", err)
|
||||||
|
}
|
||||||
|
case <-time.After(time.Duration(time.Second)):
|
||||||
|
t.Logf("service.Run() survived a client request without an error")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user