MCPcopy Create free account
hub / github.com/aptly-dev/aptly / SetUpTest

Method SetUpTest

api/middleware_test.go:27–48  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

25var _ = Suite(&MiddlewareSuite{})
26
27func (s *MiddlewareSuite) SetUpTest(c *C) {
28 r, w, err := os.Pipe()
29 c.Assert(err, IsNil)
30
31 utils.SetupJSONLogger("debug", w)
32 mw := JSONLogger()
33
34 router := gin.New()
35 router.UseRawPath = true
36 router.Use(mw)
37 router.Use(gin.Recovery(), gin.ErrorLogger())
38
39 root := router.Group("/api")
40 isReady := &atomic.Value{}
41 isReady.Store(false)
42 root.GET("/ready", apiReady(isReady))
43 root.GET("/healthy", apiHealthy)
44
45 s.router = router
46 s.logReader = r
47 s.logWriter = w
48}
49
50func (s *MiddlewareSuite) TearDownTest(c *C) {
51 s.router = nil

Callers

nothing calls this directly

Calls 3

SetupJSONLoggerFunction · 0.92
JSONLoggerFunction · 0.85
apiReadyFunction · 0.85

Tested by

no test coverage detected