Skip to content

Commit 633f0e7

Browse files
committed
fix test
1 parent 17abc0b commit 633f0e7

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

modules/gitrepo/gitrepo.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ func RepositoryFromRequestContextOrOpen(ctx context.Context, ds reqctx.RequestDa
6464
if err != nil {
6565
return nil, err
6666
}
67-
ds.AddCleanUp(func() {
68-
gitRepo.Close()
69-
})
67+
ds.AddCloser(gitRepo)
7068
ds.SetContextValue(ck, gitRepo)
7169
return gitRepo, nil
7270
}

services/context/context_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func TestRemoveSessionCookieHeader(t *testing.T) {
2626
}
2727

2828
func TestRedirectToCurrentSite(t *testing.T) {
29+
setting.IsInTesting = true
2930
defer test.MockVariableValue(&setting.AppURL, "http://localhost:3000/sub/")()
3031
defer test.MockVariableValue(&setting.AppSubURL, "/sub")()
3132
cases := []struct {
@@ -40,7 +41,7 @@ func TestRedirectToCurrentSite(t *testing.T) {
4041
t.Run(c.location, func(t *testing.T) {
4142
req := &http.Request{URL: &url.URL{Path: "/"}}
4243
resp := httptest.NewRecorder()
43-
base := NewBaseContext(resp, req)
44+
base := NewBaseContextForTest(resp, req)
4445
ctx := NewWebContext(base, nil, nil)
4546
ctx.RedirectToCurrentSite(c.location)
4647
redirect := test.RedirectURL(resp)

0 commit comments

Comments
 (0)