Skip to content

Commit

Permalink
add: config file test
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-shi committed Sep 6, 2024
1 parent 0d79eda commit 1fcf96a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/post/rpc/post_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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()

// 运行测试
Expand Down

0 comments on commit 1fcf96a

Please sign in to comment.