tenant: admin batch topup

This commit is contained in:
2025-12-19 13:55:20 +08:00
parent 86a1a0a2cc
commit 17d51d5ed2
11 changed files with 771 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package testx
import (
"context"
"testing"
"quyun/v2/database"
@@ -10,6 +11,7 @@ import (
"go.ipao.vip/atom"
"go.ipao.vip/atom/container"
"go.uber.org/dig"
"github.com/rogeecn/fabfile"
. "github.com/smartystreets/goconvey/convey"
@@ -26,6 +28,13 @@ func Default(providers ...container.ProviderContainer) container.Providers {
func Serve(providers container.Providers, t *testing.T, invoke any) {
Convey("tests boot up", t, func() {
// 关键语义:测试用例可能会在同一进程内多次调用 Serve。
// atom/config.Load 会向全局 dig 容器重复 Provide *viper.Viper若不重置会导致 “already provided”。
// 因此每次测试启动前都重置容器,保证各测试套件相互独立。
container.Close()
container.Container = dig.New()
So(container.Container.Provide(func() context.Context { return context.Background() }), ShouldBeNil)
file := fabfile.MustFind("config.toml")
// localEnv := os.Getenv("ENV_LOCAL")