|
|
@ -4,9 +4,21 @@ import (
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/discov"
|
|
|
|
"github.com/zeromicro/go-zero/core/netx"
|
|
|
|
"github.com/zeromicro/go-zero/core/netx"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestNewRpcPubServer(t *testing.T) {
|
|
|
|
|
|
|
|
s, err := NewRpcPubServer(discov.EtcdConf{
|
|
|
|
|
|
|
|
User: "user",
|
|
|
|
|
|
|
|
Pass: "pass",
|
|
|
|
|
|
|
|
}, "", ServerMiddlewaresConf{})
|
|
|
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
assert.NotPanics(t, func() {
|
|
|
|
|
|
|
|
s.Start(nil)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestFigureOutListenOn(t *testing.T) {
|
|
|
|
func TestFigureOutListenOn(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
tests := []struct {
|
|
|
|
input string
|
|
|
|
input string
|
|
|
@ -24,6 +36,10 @@ func TestFigureOutListenOn(t *testing.T) {
|
|
|
|
input: ":8080",
|
|
|
|
input: ":8080",
|
|
|
|
expect: netx.InternalIp() + ":8080",
|
|
|
|
expect: netx.InternalIp() + ":8080",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
input: "",
|
|
|
|
|
|
|
|
expect: netx.InternalIp(),
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for _, test := range tests {
|
|
|
|
for _, test := range tests {
|
|
|
|