Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
973ae22
Make integration tests cacheable, dedupe Makefile DB targets
silverwind Apr 28, 2026
d4e49d9
Chdir to source root in SetupGiteaTestEnv
silverwind Apr 28, 2026
4adf51d
Drop stale /integrations.test from .gitignore
silverwind Apr 28, 2026
32d2f02
Move test cwd anchor out of SetupGiteaTestEnv
silverwind Apr 28, 2026
2ef5389
Use t.Chdir in migration test init
silverwind Apr 28, 2026
9ffdbc4
Make test fixture paths package-relative
silverwind Apr 28, 2026
8568769
Make test-echo render command path package-relative
silverwind Apr 28, 2026
11c0ef4
Anchor test fixture paths at GetGiteaTestSourceRoot
silverwind Apr 28, 2026
3572731
Drop integration benchmarks, superseded by package-level benchmarks
silverwind Apr 28, 2026
9d32c0a
Use GITEA_TEST_ROOT for ini render-command substitution
silverwind Apr 28, 2026
d7e4fd5
clean up
wxiaoguang Apr 28, 2026
f1afc4a
fix
wxiaoguang Apr 28, 2026
845f7de
fix makefile
wxiaoguang Apr 28, 2026
a5fbaa0
fix
wxiaoguang Apr 28, 2026
f931b8e
Merge branch 'main' into cacheable-integration-tests
wxiaoguang Apr 28, 2026
5b45220
Drop test-integration binary, stream progress via go test -v
silverwind Apr 28, 2026
cf032e3
Capture test logs internally instead of routing through t.Log
silverwind Apr 28, 2026
c75829d
Revert "Capture test logs internally instead of routing through t.Log"
silverwind Apr 28, 2026
26bf533
Revert "Drop test-integration binary, stream progress via go test -v"
silverwind Apr 28, 2026
2cb3bd5
Merge branch 'cacheable-integration-tests' of github.com:silverwind/g…
lunny Apr 28, 2026
631f733
Upgrade xgo to 1.26.x
lunny Apr 28, 2026
ccd655e
Split e2e CI step so build and test durations are visible
silverwind Apr 28, 2026
ae602f6
Fix Test_DropTableColumns skip and rewrite test-integration FIXME
silverwind Apr 28, 2026
73e1a7b
Merge branch 'main' into cacheable-integration-tests
silverwind Apr 28, 2026
c8e0df7
Merge branch 'main' into cacheable-integration-tests
silverwind Apr 29, 2026
2b22e24
docke dryrun in parallel
wxiaoguang Apr 29, 2026
54243d7
Merge branch 'main' into cacheable-integration-tests
wxiaoguang Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ cpu.out
/gitea-e2e
/gitea-vet
/debug
/integrations.test

/bin
/dist
Expand Down
167 changes: 35 additions & 132 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ clean-all: clean ## delete backend, frontend and integration files
.PHONY: clean
clean: ## delete backend and integration files
rm -rf $(EXECUTABLE) $(EXECUTABLE_E2E) $(DIST) $(BINDATA_DEST_WILDCARD) \
integrations*.test \
integrations*.test migrations*.test \
tests/integration/gitea-integration-* \
Comment thread
wxiaoguang marked this conversation as resolved.
Outdated
tests/integration/indexers-* \
tests/sqlite.ini tests/mysql.ini tests/pgsql.ini tests/mssql.ini man/ \
Expand Down Expand Up @@ -441,19 +441,9 @@ $(GO_LICENSE_FILE): go.mod go.sum
generate-ini-sqlite:
sed -e 's|{{WORK_PATH}}|$(CURDIR)/tests/$(or $(TEST_TYPE),integration)/gitea-$(or $(TEST_TYPE),integration)-sqlite|g' \
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
-e 's|{{GITEA_TEST_ROOT}}|$(or $(GITEA_TEST_ROOT),$(CURDIR))|g' \
tests/sqlite.ini.tmpl > tests/sqlite.ini

.PHONY: test-sqlite
test-sqlite: integrations.sqlite.test generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini ./integrations.sqlite.test

.PHONY: test-sqlite\#%
test-sqlite\#%: integrations.sqlite.test generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini ./integrations.sqlite.test -test.run $(subst .,/,$*)

.PHONY: test-sqlite-migration
test-sqlite-migration: migrations.sqlite.test migrations.individual.sqlite.test

generate-ini-mysql:
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
Expand All @@ -463,17 +453,6 @@ generate-ini-mysql:
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
tests/mysql.ini.tmpl > tests/mysql.ini

.PHONY: test-mysql
test-mysql: integrations.mysql.test generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini ./integrations.mysql.test

.PHONY: test-mysql\#%
test-mysql\#%: integrations.mysql.test generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini ./integrations.mysql.test -test.run $(subst .,/,$*)

.PHONY: test-mysql-migration
test-mysql-migration: migrations.mysql.test migrations.individual.mysql.test

generate-ini-pgsql:
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
Expand All @@ -485,17 +464,6 @@ generate-ini-pgsql:
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
tests/pgsql.ini.tmpl > tests/pgsql.ini

.PHONY: test-pgsql
test-pgsql: integrations.pgsql.test generate-ini-pgsql
GITEA_TEST_CONF=tests/pgsql.ini ./integrations.pgsql.test

.PHONY: test-pgsql\#%
test-pgsql\#%: integrations.pgsql.test generate-ini-pgsql
GITEA_TEST_CONF=tests/pgsql.ini ./integrations.pgsql.test -test.run $(subst .,/,$*)

.PHONY: test-pgsql-migration
test-pgsql-migration: migrations.pgsql.test migrations.individual.pgsql.test

generate-ini-mssql:
sed -e 's|{{TEST_MSSQL_HOST}}|${TEST_MSSQL_HOST}|g' \
-e 's|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \
Expand All @@ -505,16 +473,37 @@ generate-ini-mssql:
-e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \
tests/mssql.ini.tmpl > tests/mssql.ini

.PHONY: test-mssql
test-mssql: integrations.mssql.test generate-ini-mssql
GITEA_TEST_CONF=tests/mssql.ini ./integrations.mssql.test
# Generate per-DB integration test/migration targets.
# args: $(1)=db (sqlite|mysql|pgsql|mssql), $(2)=optional extra flags (e.g. -tags '...')
define DB_INTEGRATION_TARGETS
.PHONY: test-$(1)
test-$(1): git-check generate-ini-$(1)
GITEA_TEST_CONF=tests/$(1).ini $$(GO) test $$(GOTESTFLAGS) -timeout 50m $(2) code.gitea.io/gitea/tests/integration

.PHONY: test-mssql\#%
test-mssql\#%: integrations.mssql.test generate-ini-mssql
GITEA_TEST_CONF=tests/mssql.ini ./integrations.mssql.test -test.run $(subst .,/,$*)
.PHONY: test-$(1)\#%
test-$(1)\#%: git-check generate-ini-$(1)
GITEA_TEST_CONF=tests/$(1).ini $$(GO) test $$(GOTESTFLAGS) -timeout 50m $(2) -run $$(subst .,/,$$*) code.gitea.io/gitea/tests/integration

.PHONY: test-mssql-migration
test-mssql-migration: migrations.mssql.test migrations.individual.mssql.test
.PHONY: test-$(1)-migration
test-$(1)-migration: migrations.$(1).test migrations.individual.$(1).test

.PHONY: migrations.$(1).test
migrations.$(1).test: git-check generate-ini-$(1)
GITEA_TEST_CONF=tests/$(1).ini $$(GO) test $$(GOTESTFLAGS) -timeout 50m $(2) code.gitea.io/gitea/tests/integration/migration-test

.PHONY: migrations.individual.$(1).test
migrations.individual.$(1).test: generate-ini-$(1)
GITEA_TEST_CONF=tests/$(1).ini $$(GO) test $$(GOTESTFLAGS) -tags '$$(TEST_TAGS)' -p 1 $$(MIGRATE_TEST_PACKAGES)

.PHONY: migrations.individual.$(1).test\#%
migrations.individual.$(1).test\#%: generate-ini-$(1)
GITEA_TEST_CONF=tests/$(1).ini $$(GO) test $$(GOTESTFLAGS) -tags '$$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$$*
Comment thread
wxiaoguang marked this conversation as resolved.
Outdated
endef

$(eval $(call DB_INTEGRATION_TARGETS,sqlite,-tags '$(TEST_TAGS)'))
$(eval $(call DB_INTEGRATION_TARGETS,mysql,))
$(eval $(call DB_INTEGRATION_TARGETS,pgsql,))
$(eval $(call DB_INTEGRATION_TARGETS,mssql,))

.PHONY: playwright
playwright: deps-frontend
Expand All @@ -525,99 +514,13 @@ playwright: deps-frontend
test-e2e: playwright $(EXECUTABLE_E2E)
@EXECUTABLE=$(EXECUTABLE_E2E) ./tools/test-e2e.sh $(GITEA_TEST_E2E_FLAGS)

.PHONY: bench-sqlite
bench-sqlite: integrations.sqlite.test generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .

.PHONY: bench-mysql
bench-mysql: integrations.mysql.test generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini ./integrations.mysql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .

.PHONY: bench-mssql
bench-mssql: integrations.mssql.test generate-ini-mssql
GITEA_TEST_CONF=tests/mssql.ini ./integrations.mssql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .

.PHONY: bench-pgsql
bench-pgsql: integrations.pgsql.test generate-ini-pgsql
GITEA_TEST_CONF=tests/pgsql.ini ./integrations.pgsql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .

.PHONY: integration-test-coverage
integration-test-coverage: integrations.cover.test generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini ./integrations.cover.test -test.coverprofile=integration.coverage.out
integration-test-coverage: git-check generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini $(GO) test $(GOTESTFLAGS) -timeout 50m -coverpkg $(shell echo $(GO_TEST_PACKAGES) | tr ' ' ',') -coverprofile=integration.coverage.out code.gitea.io/gitea/tests/integration

.PHONY: integration-test-coverage-sqlite
integration-test-coverage-sqlite: integrations.cover.sqlite.test generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini ./integrations.cover.sqlite.test -test.coverprofile=integration.coverage.out

integrations.mysql.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.mysql.test

integrations.pgsql.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.pgsql.test

integrations.mssql.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.mssql.test

integrations.sqlite.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.sqlite.test -tags '$(TEST_TAGS)'

integrations.cover.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -coverpkg $(shell echo $(GO_TEST_PACKAGES) | tr ' ' ',') -o integrations.cover.test

integrations.cover.sqlite.test: git-check $(GO_SOURCES)
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -coverpkg $(shell echo $(GO_TEST_PACKAGES) | tr ' ' ',') -o integrations.cover.sqlite.test -tags '$(TEST_TAGS)'

.PHONY: migrations.mysql.test
migrations.mysql.test: $(GO_SOURCES) generate-ini-mysql
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.mysql.test
GITEA_TEST_CONF=tests/mysql.ini ./migrations.mysql.test

.PHONY: migrations.pgsql.test
migrations.pgsql.test: $(GO_SOURCES) generate-ini-pgsql
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.pgsql.test
GITEA_TEST_CONF=tests/pgsql.ini ./migrations.pgsql.test

.PHONY: migrations.mssql.test
migrations.mssql.test: $(GO_SOURCES) generate-ini-mssql
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.mssql.test
GITEA_TEST_CONF=tests/mssql.ini ./migrations.mssql.test

.PHONY: migrations.sqlite.test
migrations.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
$(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.sqlite.test -tags '$(TEST_TAGS)'
GITEA_TEST_CONF=tests/sqlite.ini ./migrations.sqlite.test

.PHONY: migrations.individual.mysql.test
migrations.individual.mysql.test: $(GO_SOURCES) generate-ini-mysql
GITEA_TEST_CONF=tests/mysql.ini $(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -p 1 $(MIGRATE_TEST_PACKAGES)

.PHONY: migrations.individual.sqlite.test\#%
migrations.individual.sqlite.test\#%: $(GO_SOURCES) generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*

.PHONY: migrations.individual.pgsql.test
migrations.individual.pgsql.test: $(GO_SOURCES) generate-ini-pgsql
GITEA_TEST_CONF=tests/pgsql.ini $(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -p 1 $(MIGRATE_TEST_PACKAGES)

.PHONY: migrations.individual.pgsql.test\#%
migrations.individual.pgsql.test\#%: $(GO_SOURCES) generate-ini-pgsql
GITEA_TEST_CONF=tests/pgsql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*

.PHONY: migrations.individual.mssql.test
migrations.individual.mssql.test: $(GO_SOURCES) generate-ini-mssql
GITEA_TEST_CONF=tests/mssql.ini $(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -p 1 $(MIGRATE_TEST_PACKAGES)

.PHONY: migrations.individual.mssql.test\#%
migrations.individual.mssql.test\#%: $(GO_SOURCES) generate-ini-mssql
GITEA_TEST_CONF=tests/mssql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*

.PHONY: migrations.individual.sqlite.test
migrations.individual.sqlite.test: $(GO_SOURCES) generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -p 1 $(MIGRATE_TEST_PACKAGES)

.PHONY: migrations.individual.sqlite.test\#%
migrations.individual.sqlite.test\#%: $(GO_SOURCES) generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$*
integration-test-coverage-sqlite: git-check generate-ini-sqlite
GITEA_TEST_CONF=tests/sqlite.ini $(GO) test $(GOTESTFLAGS) -timeout 50m -tags '$(TEST_TAGS)' -coverpkg $(shell echo $(GO_TEST_PACKAGES) | tr ' ' ',') -coverprofile=integration.coverage.out code.gitea.io/gitea/tests/integration

.PHONY: check
check: test
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/api_org_avatar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"encoding/base64"
"net/http"
"os"
"path/filepath"
"testing"

auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/tests"

Expand All @@ -24,7 +26,7 @@ func TestAPIUpdateOrgAvatar(t *testing.T) {
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteOrganization)

// Test what happens if you use a valid image
avatar, err := os.ReadFile("tests/integration/avatar.png")
avatar, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/avatar.png"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open avatar.png")
Expand All @@ -48,7 +50,7 @@ func TestAPIUpdateOrgAvatar(t *testing.T) {
MakeRequest(t, req, http.StatusBadRequest)

// Test what happens if you use a file that is not an image
text, err := os.ReadFile("tests/integration/README.md")
text, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/README.md"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open README.md")
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/api_repo_avatar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import (
"fmt"
"net/http"
"os"
"path/filepath"
"testing"

auth_model "code.gitea.io/gitea/models/auth"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/tests"

Expand All @@ -28,7 +30,7 @@ func TestAPIUpdateRepoAvatar(t *testing.T) {
token := getUserToken(t, user2.LowerName, auth_model.AccessTokenScopeWriteRepository)

// Test what happens if you use a valid image
avatar, err := os.ReadFile("tests/integration/avatar.png")
avatar, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/avatar.png"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open avatar.png")
Expand All @@ -52,7 +54,7 @@ func TestAPIUpdateRepoAvatar(t *testing.T) {
MakeRequest(t, req, http.StatusBadRequest)

// Test what happens if you use a file that is not an image
text, err := os.ReadFile("tests/integration/README.md")
text, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/README.md"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open README.md")
Expand Down
29 changes: 0 additions & 29 deletions tests/integration/api_repo_file_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,35 +124,6 @@ func getExpectedFileResponseForCreate(info apiFileResponseInfo) *api.FileRespons
return ret
}

func BenchmarkAPICreateFileSmall(b *testing.B) {
onGiteaRun(b, func(b *testing.B, u *url.URL) {
user2 := unittest.AssertExistsAndLoadBean(b, &user_model.User{ID: 2}) // owner of the repo1 & repo16
repo1 := unittest.AssertExistsAndLoadBean(b, &repo_model.Repository{ID: 1}) // public repo

b.ResetTimer()
for n := 0; b.Loop(); n++ {
treePath := fmt.Sprintf("update/file%d.txt", n)
_, _ = createFile(user2, repo1, treePath)
}
})
}

func BenchmarkAPICreateFileMedium(b *testing.B) {
data := make([]byte, 10*1024*1024)

onGiteaRun(b, func(b *testing.B, u *url.URL) {
user2 := unittest.AssertExistsAndLoadBean(b, &user_model.User{ID: 2}) // owner of the repo1 & repo16
repo1 := unittest.AssertExistsAndLoadBean(b, &repo_model.Repository{ID: 1}) // public repo

b.ResetTimer()
for n := 0; b.Loop(); n++ {
treePath := fmt.Sprintf("update/file%d.txt", n)
copy(data, treePath)
_, _ = createFile(user2, repo1, treePath)
}
})
}

func TestAPICreateFile(t *testing.T) {
onGiteaRun(t, func(t *testing.T, u *url.URL) {
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) // owner of the repo1 & repo16
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/api_user_avatar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"encoding/base64"
"net/http"
"os"
"path/filepath"
"testing"

auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/tests"

Expand All @@ -24,7 +26,7 @@ func TestAPIUpdateUserAvatar(t *testing.T) {
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteUser)

// Test what happens if you use a valid image
avatar, err := os.ReadFile("tests/integration/avatar.png")
avatar, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/avatar.png"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open avatar.png")
Expand All @@ -48,7 +50,7 @@ func TestAPIUpdateUserAvatar(t *testing.T) {
MakeRequest(t, req, http.StatusBadRequest)

// Test what happens if you use a file that is not an image
text, err := os.ReadFile("tests/integration/README.md")
text, err := os.ReadFile(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/README.md"))
assert.NoError(t, err)
if err != nil {
assert.FailNow(t, "Unable to open README.md")
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/gpg_ssh_git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net/http"
"net/url"
"os"
"path/filepath"
"testing"

auth_model "code.gitea.io/gitea/models/auth"
Expand Down Expand Up @@ -325,10 +326,11 @@ func crudActionCreateFile(_ *testing.T, ctx APITestContext, user *user_model.Use
}

func importTestingKey() (*openpgp.Entity, error) {
if _, _, err := process.GetManager().Exec("gpg --import tests/integration/private-testing.key", "gpg", "--import", "tests/integration/private-testing.key"); err != nil {
keyPath := filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/private-testing.key")
if _, _, err := process.GetManager().Exec("gpg --import "+keyPath, "gpg", "--import", keyPath); err != nil {
return nil, err
}
keyringFile, err := os.Open("tests/integration/private-testing.key")
keyringFile, err := os.Open(keyPath)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/migration-test/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func initMigrationTest(t *testing.T) func() {
}

func availableVersions() ([]string, error) {
migrationsDir, err := os.Open("tests/integration/migration-test")
migrationsDir, err := os.Open(filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/migration-test"))
if err != nil {
return nil, err
}
Expand All @@ -75,7 +75,7 @@ func availableVersions() ([]string, error) {
}

func readSQLFromFile(version string) (string, error) {
filename := fmt.Sprintf("tests/integration/migration-test/gitea-v%s.%s.sql.gz", version, setting.Database.Type)
filename := filepath.Join(setting.GetGiteaTestSourceRoot(), "tests/integration/migration-test", fmt.Sprintf("gitea-v%s.%s.sql.gz", version, setting.Database.Type))

if _, err := os.Stat(filename); os.IsNotExist(err) {
return "", nil
Expand Down
Loading