| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 | package debug_testimport (	"io/ioutil"	"kpt-pasture/dep"	"kpt-pasture/http/middleware"	"kpt-pasture/http/route"	"kpt-pasture/module/backend"	kptservicemock "kpt-pasture/module/backend/mock"	"kpt-pasture/test/mock"	"os"	"testing"	"go.uber.org/dig"	"github.com/gin-gonic/gin"	"github.com/golang/mock/gomock")func TestMain(m *testing.M) {	gin.SetMode(gin.ReleaseMode)	gin.DefaultWriter = ioutil.Discard	os.Exit(m.Run())}type Mock struct {	dig.In	KptService *kptservicemock.MockKptService}func fakeServer(t *testing.T) (*gin.Engine, *gomock.Controller, *Mock) {	ctrl := gomock.NewController(t)	var currMock *Mock	mock.GetMock(ctrl, func(entry Mock) { currMock = &entry })	g := gin.New()	route.HTTPServerRoute(func(engine *gin.Engine) {		engine.Use(middleware.WithDependency(&dep.HttpDependency{			StoreEventHub: backend.Hub{				OpsService: currMock.KptService,			},		}))	})(g)	return g, ctrl, currMock}
 |