diff --git a/app/post/rpc/post_test.go b/app/post/rpc/post_test.go index 6641104..e5fa184 100644 --- a/app/post/rpc/post_test.go +++ b/app/post/rpc/post_test.go @@ -10,6 +10,7 @@ import ( "github.com/seth-shi/go-zero-testing-example/app/post/rpc/internal/faker" "github.com/seth-shi/go-zero-testing-example/app/post/rpc/internal/svc" "github.com/seth-shi/go-zero-testing-example/app/post/rpc/post" + "github.com/seth-shi/go-zero-testing-example/pkg" "github.com/stretchr/testify/require" "github.com/zeromicro/go-zero/zrpc" ) @@ -21,6 +22,18 @@ func TestMain(m *testing.M) { return faker.GetValue().SvcCtx } + data := `Name: post.rpc +ListenOn: 0.0.0.0:8080 +DataSource: 127.0.0.1:3306?charset=utf8mb4&parseTime=true&loc=Local +IdRpc: + Target: 0.0.0.0:8081 +RedisConf: + Host: 127.0.0.1:6379 +` + remove, tmp := lo.Must2(pkg.CreateTempFile(".yaml", data)) + defer remove() + configFile = tmp + go main() // 运行测试