From 1fcf96a191b4f81a2598c4b6626024ce7e0ee902 Mon Sep 17 00:00:00 2001 From: seth-shi <1033404553@qq.com> Date: Fri, 6 Sep 2024 16:21:58 +0800 Subject: [PATCH] add: config file test --- app/post/rpc/post_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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() // 运行测试