This commit is contained in:
Kevin Wan
2021-02-17 21:42:22 +08:00
committed by GitHub
parent 38abfb80ed
commit 9602494454
4 changed files with 70 additions and 60 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/core/discov"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/core/netx"
"github.com/tal-tech/go-zero/core/service"
"github.com/tal-tech/go-zero/core/stat"
"github.com/tal-tech/go-zero/core/stores/redis"
@@ -16,31 +15,6 @@ import (
"google.golang.org/grpc"
)
func TestFigureOutListenOn(t *testing.T) {
tests := []struct {
input string
expect string
}{
{
input: "192.168.0.5:1234",
expect: "192.168.0.5:1234",
},
{
input: "0.0.0.0:8080",
expect: netx.InternalIp() + ":8080",
},
{
input: ":8080",
expect: netx.InternalIp() + ":8080",
},
}
for _, test := range tests {
val := figureOutListenOn(test.input)
assert.Equal(t, test.expect, val)
}
}
func TestServer_setupInterceptors(t *testing.T) {
server := new(mockedServer)
err := setupInterceptors(server, RpcServerConf{