optimize unit test (#999)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/tal-tech/go-zero/core/logx"
|
||||
"github.com/tal-tech/go-zero/core/stringx"
|
||||
conf "github.com/tal-tech/go-zero/tools/goctl/config"
|
||||
@@ -45,7 +46,7 @@ func TestRpcGenerate(t *testing.T) {
|
||||
|
||||
// case go path
|
||||
t.Run("GOPATH", func(t *testing.T) {
|
||||
err = g.Generate("./test.proto", projectDir, []string{common, src}, "Mbase/common.proto=./base")
|
||||
err = g.Generate("./test.proto", projectDir, []string{common}, "Mbase/common.proto=./base")
|
||||
assert.Nil(t, err)
|
||||
_, err = execx.Run("go test "+projectName, projectDir)
|
||||
if err != nil {
|
||||
@@ -66,7 +67,7 @@ func TestRpcGenerate(t *testing.T) {
|
||||
}
|
||||
|
||||
projectDir = filepath.Join(workDir, projectName)
|
||||
err = g.Generate("./test.proto", projectDir, []string{common, src}, "Mbase/common.proto=./base")
|
||||
err = g.Generate("./test.proto", projectDir, []string{common}, "Mbase/common.proto=./base")
|
||||
assert.Nil(t, err)
|
||||
_, err = execx.Run("go test "+projectName, projectDir)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,14 +4,11 @@ syntax = "proto3";
|
||||
package test;
|
||||
|
||||
import "base/common.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
option go_package = "github.com/test";
|
||||
|
||||
message Req {
|
||||
string in = 1;
|
||||
common.User user = 2;
|
||||
google.protobuf.Any object = 4;
|
||||
}
|
||||
|
||||
message Reply {
|
||||
|
||||
@@ -121,8 +121,13 @@ func ReadLink(name string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if name == "/" {
|
||||
return "/", nil
|
||||
if _, err := os.Lstat(name); err != nil {
|
||||
return name, nil
|
||||
}
|
||||
|
||||
// uncheck condition: ignore file path /var, maybe be temporary file path
|
||||
if name == "/" || name == "/var" {
|
||||
return name, nil
|
||||
}
|
||||
|
||||
isLink, err := isLink(name)
|
||||
|
||||
Reference in New Issue
Block a user