File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,7 @@ SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl \| JSEscape}}/api/v1"|"basePa
170170SWAGGER_EXCLUDE := code.gitea.io/sdk
171171SWAGGER_NEWLINE_COMMAND := -e '$$a\'
172172
173+ TEST_SQLITE_PATH ?= :memory:
173174TEST_MYSQL_HOST ?= mysql:3306
174175TEST_MYSQL_DBNAME ?= testgitea
175176TEST_MYSQL_USERNAME ?= root
@@ -532,7 +533,8 @@ $(GO_LICENSE_FILE): go.mod go.sum
532533 @rm -rf $(GO_LICENSE_TMP_DIR )
533534
534535generate-ini-sqlite :
535- sed -e ' s|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
536+ sed -e ' s|{{TEST_SQLITE_PATH}}|${TEST_SQLITE_PATH}|g' \
537+ -e ' s|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
536538 -e ' s|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
537539 -e ' s|{{TEST_TYPE}}|$(or $(TEST_TYPE),integration)|g' \
538540 tests/sqlite.ini.tmpl > tests/sqlite.ini
Original file line number Diff line number Diff line change @@ -119,8 +119,10 @@ func DBConnStr() (string, error) {
119119 if ! EnableSQLite3 {
120120 return "" , errors .New ("this Gitea binary was not built with SQLite3 support" )
121121 }
122- if err := os .MkdirAll (filepath .Dir (Database .Path ), os .ModePerm ); err != nil {
123- return "" , fmt .Errorf ("Failed to create directories: %w" , err )
122+ if Database .Path != ":memory:" && Database .Path != "" && Database .Path [0 ] != '/' {
123+ if err := os .MkdirAll (filepath .Dir (Database .Path ), os .ModePerm ); err != nil {
124+ return "" , fmt .Errorf ("Failed to create directories: %w" , err )
125+ }
124126 }
125127 journalMode := ""
126128 if Database .SQLiteJournalMode != "" {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ RUN_MODE = prod
33
44[database]
55DB_TYPE = sqlite3
6- PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-sqlite/gitea.db
6+ PATH = {{TEST_SQLITE_PATH}}
77
88[indexer]
99REPO_INDEXER_ENABLED = true
You can’t perform that action at this time.
0 commit comments