From 3d3bdc5b9902d6e6c83d1d3861b3b35454b70a71 Mon Sep 17 00:00:00 2001 From: Dima Krasner Date: Mon, 14 Oct 2024 20:29:58 +0300 Subject: [PATCH] bypass cache in tests --- test/server.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/server.go b/test/server.go index 35ad206..5290dfe 100644 --- a/test/server.go +++ b/test/server.go @@ -41,7 +41,6 @@ type server struct { cfg *cfg.Config db *sql.DB dbPath string - handler front.Handler Alice *ap.Actor Bob *ap.Actor Carol *ap.Actor @@ -94,16 +93,10 @@ func newTestServer() *server { panic(err) } - handler, err := front.NewHandler(domain, false, &cfg, fed.NewResolver(nil, domain, &cfg, &http.Client{}, db), db) - if err != nil { - panic(err) - } - return &server{ cfg: &cfg, dbPath: path, db: db, - handler: handler, Alice: alice, Bob: bob, Carol: carol, @@ -117,9 +110,14 @@ func (s *server) Handle(request string, user *ap.Actor) string { panic(err) } + handler, err := front.NewHandler(domain, false, s.cfg, fed.NewResolver(nil, domain, s.cfg, &http.Client{}, s.db), s.db) + if err != nil { + panic(err) + } + var buf bytes.Buffer w := gmi.Wrap(&buf) - s.handler.Handle( + handler.Handle( &front.Request{ Context: context.Background(), URL: u, @@ -140,9 +138,14 @@ func (s *server) Upload(request string, user *ap.Actor, body []byte) string { } u.Scheme = "titan" + handler, err := front.NewHandler(domain, false, s.cfg, fed.NewResolver(nil, domain, s.cfg, &http.Client{}, s.db), s.db) + if err != nil { + panic(err) + } + var buf bytes.Buffer w := gmi.Wrap(&buf) - s.handler.Handle( + handler.Handle( &front.Request{ Context: context.Background(), URL: u,