Add system setting table with cache and also add cache supports for user setting (#18058)

This commit is contained in:
Lunny Xiao 2022-10-17 07:29:26 +08:00 committed by GitHub
parent 5d3dbffa15
commit f860a6d2e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 1117 additions and 436 deletions

View file

@ -7,12 +7,12 @@ package unittest
import (
"context"
"fmt"
"net/url"
"os"
"path/filepath"
"testing"
"code.gitea.io/gitea/models/db"
system_model "code.gitea.io/gitea/models/system"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
@ -91,10 +91,8 @@ func MainTest(m *testing.M, testOpts *TestOptions) {
setting.AppDataPath = appDataPath
setting.AppWorkPath = testOpts.GiteaRootPath
setting.StaticRootPath = testOpts.GiteaRootPath
setting.GravatarSourceURL, err = url.Parse("https://secure.gravatar.com/avatar/")
if err != nil {
fatalTestError("url.Parse: %v\n", err)
}
setting.GravatarSource = "https://secure.gravatar.com/avatar/"
setting.Attachment.Storage.Path = filepath.Join(setting.AppDataPath, "attachments")
setting.LFS.Storage.Path = filepath.Join(setting.AppDataPath, "lfs")
@ -112,6 +110,9 @@ func MainTest(m *testing.M, testOpts *TestOptions) {
if err = storage.Init(); err != nil {
fatalTestError("storage.Init: %v\n", err)
}
if err = system_model.Init(); err != nil {
fatalTestError("models.Init: %v\n", err)
}
if err = util.RemoveAll(repoRootPath); err != nil {
fatalTestError("util.RemoveAll: %v\n", err)