mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 04:12:10 +00:00
Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v1.64.6 (forgejo) (#7118)
Some checks failed
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Integration tests for the release process / release-simulation (push) Has been cancelled
Some checks failed
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Integration tests for the release process / release-simulation (push) Has been cancelled
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org> Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
This commit is contained in:
parent
bb0e26a7b4
commit
6b436955fc
97 changed files with 258 additions and 345 deletions
|
@ -60,7 +60,7 @@ func onForgejoRunTB(t testing.TB, callback func(testing.TB, *url.URL), prepare .
|
|||
|
||||
defer func() {
|
||||
require.NoError(t, os.WriteFile(setting.CustomConf, conf, 0o644))
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), 2*time.Minute)
|
||||
s.Shutdown(ctx)
|
||||
cancel()
|
||||
}()
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
@ -416,7 +415,7 @@ jobs:
|
|||
actionTask := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionTask{ID: task.Id})
|
||||
actionRunJob := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRunJob{ID: actionTask.JobID})
|
||||
actionRun := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{ID: actionRunJob.RunID})
|
||||
require.NoError(t, actionRun.LoadAttributes(context.Background()))
|
||||
require.NoError(t, actionRun.LoadAttributes(t.Context()))
|
||||
|
||||
assert.Equal(t, user2.Name, gtCtx["actor"].GetStringValue())
|
||||
assert.Equal(t, setting.AppURL+"api/v1", gtCtx["api_url"].GetStringValue())
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -71,12 +70,12 @@ func TestActionsWebRouteLatestWorkflowRun(t *testing.T) {
|
|||
|
||||
// Verify that each points to the correct workflow.
|
||||
workflowOne := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{RepoID: repo.ID, Index: 1})
|
||||
err := workflowOne.LoadAttributes(context.Background())
|
||||
err := workflowOne.LoadAttributes(t.Context())
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, workflowOneURI, workflowOne.HTMLURL())
|
||||
|
||||
workflowTwo := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{RepoID: repo.ID, Index: 2})
|
||||
err = workflowTwo.LoadAttributes(context.Background())
|
||||
err = workflowTwo.LoadAttributes(t.Context())
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, workflowTwoURI, workflowTwo.HTMLURL())
|
||||
})
|
||||
|
@ -141,7 +140,7 @@ func TestActionsWebRouteLatestRun(t *testing.T) {
|
|||
|
||||
// Verify that it redirects to the run we just created
|
||||
workflow := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{RepoID: repo.ID})
|
||||
err := workflow.LoadAttributes(context.Background())
|
||||
err := workflow.LoadAttributes(t.Context())
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, workflow.HTMLURL(), resp.Header().Get("Location"))
|
||||
|
@ -170,7 +169,7 @@ func TestActionsArtifactDeletion(t *testing.T) {
|
|||
|
||||
// Load the run we just created
|
||||
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{RepoID: repo.ID})
|
||||
err := run.LoadAttributes(context.Background())
|
||||
err := run.LoadAttributes(t.Context())
|
||||
require.NoError(t, err)
|
||||
|
||||
// Visit it's web view
|
||||
|
|
|
@ -61,7 +61,7 @@ func newMockRunnerClient(uuid, token string) *mockRunnerClient {
|
|||
}
|
||||
|
||||
func (r *mockRunner) doPing(t *testing.T) {
|
||||
resp, err := r.client.pingServiceClient.Ping(context.Background(), connect.NewRequest(&pingv1.PingRequest{
|
||||
resp, err := r.client.pingServiceClient.Ping(t.Context(), connect.NewRequest(&pingv1.PingRequest{
|
||||
Data: "mock-runner",
|
||||
}))
|
||||
require.NoError(t, err)
|
||||
|
@ -70,7 +70,7 @@ func (r *mockRunner) doPing(t *testing.T) {
|
|||
|
||||
func (r *mockRunner) doRegister(t *testing.T, name, token string, labels []string) {
|
||||
r.doPing(t)
|
||||
resp, err := r.client.runnerServiceClient.Register(context.Background(), connect.NewRequest(&runnerv1.RegisterRequest{
|
||||
resp, err := r.client.runnerServiceClient.Register(t.Context(), connect.NewRequest(&runnerv1.RegisterRequest{
|
||||
Name: name,
|
||||
Token: token,
|
||||
Version: "mock-runner-version",
|
||||
|
@ -104,7 +104,7 @@ func (r *mockRunner) fetchTask(t *testing.T, timeout ...time.Duration) *runnerv1
|
|||
ddl := time.Now().Add(fetchTimeout)
|
||||
var task *runnerv1.Task
|
||||
for time.Now().Before(ddl) {
|
||||
resp, err := r.client.runnerServiceClient.FetchTask(context.Background(), connect.NewRequest(&runnerv1.FetchTaskRequest{
|
||||
resp, err := r.client.runnerServiceClient.FetchTask(t.Context(), connect.NewRequest(&runnerv1.FetchTaskRequest{
|
||||
TasksVersion: 0,
|
||||
}))
|
||||
require.NoError(t, err)
|
||||
|
@ -127,7 +127,7 @@ type mockTaskOutcome struct {
|
|||
|
||||
func (r *mockRunner) execTask(t *testing.T, task *runnerv1.Task, outcome *mockTaskOutcome) {
|
||||
for idx, lr := range outcome.logRows {
|
||||
resp, err := r.client.runnerServiceClient.UpdateLog(context.Background(), connect.NewRequest(&runnerv1.UpdateLogRequest{
|
||||
resp, err := r.client.runnerServiceClient.UpdateLog(t.Context(), connect.NewRequest(&runnerv1.UpdateLogRequest{
|
||||
TaskId: task.Id,
|
||||
Index: int64(idx),
|
||||
Rows: []*runnerv1.LogRow{lr},
|
||||
|
@ -138,7 +138,7 @@ func (r *mockRunner) execTask(t *testing.T, task *runnerv1.Task, outcome *mockTa
|
|||
}
|
||||
sentOutputKeys := make([]string, 0, len(outcome.outputs))
|
||||
for outputKey, outputValue := range outcome.outputs {
|
||||
resp, err := r.client.runnerServiceClient.UpdateTask(context.Background(), connect.NewRequest(&runnerv1.UpdateTaskRequest{
|
||||
resp, err := r.client.runnerServiceClient.UpdateTask(t.Context(), connect.NewRequest(&runnerv1.UpdateTaskRequest{
|
||||
State: &runnerv1.TaskState{
|
||||
Id: task.Id,
|
||||
Result: runnerv1.Result_RESULT_UNSPECIFIED,
|
||||
|
@ -150,7 +150,7 @@ func (r *mockRunner) execTask(t *testing.T, task *runnerv1.Task, outcome *mockTa
|
|||
assert.ElementsMatch(t, sentOutputKeys, resp.Msg.SentOutputs)
|
||||
}
|
||||
time.Sleep(outcome.execTime)
|
||||
resp, err := r.client.runnerServiceClient.UpdateTask(context.Background(), connect.NewRequest(&runnerv1.UpdateTaskRequest{
|
||||
resp, err := r.client.runnerServiceClient.UpdateTask(t.Context(), connect.NewRequest(&runnerv1.UpdateTaskRequest{
|
||||
State: &runnerv1.TaskState{
|
||||
Id: task.Id,
|
||||
Result: outcome.result,
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -131,7 +130,7 @@ func TestSourceId(t *testing.T) {
|
|||
LoginType: auth_model.Plain,
|
||||
LoginSource: 23,
|
||||
}
|
||||
defer createUser(context.Background(), t, testUser23)()
|
||||
defer createUser(t.Context(), t, testUser23)()
|
||||
|
||||
session := loginUser(t, "user1")
|
||||
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadAdmin)
|
||||
|
@ -163,7 +162,7 @@ func TestAdminViewUsersSorted(t *testing.T) {
|
|||
defer tests.PrepareTestEnv(t)()
|
||||
createTimestamp := time.Now().Unix() - 1000
|
||||
updateTimestamp := time.Now().Unix() - 500
|
||||
sess := db.GetEngine(context.Background())
|
||||
sess := db.GetEngine(t.Context())
|
||||
|
||||
// Create 10 users with login source 44
|
||||
for i := int64(1); i <= 10; i++ {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -286,7 +285,7 @@ func doAPIMergePullRequestForm(t *testing.T, ctx APITestContext, owner, repo str
|
|||
if err.Message != "Please try again later" {
|
||||
break
|
||||
}
|
||||
queue.GetManager().FlushAll(context.Background(), 5*time.Second)
|
||||
queue.GetManager().FlushAll(t.Context(), 5*time.Second)
|
||||
<-time.After(1 * time.Second)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
func TestAPIPrivateNoServ(t *testing.T) {
|
||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(t.Context())
|
||||
defer cancel()
|
||||
key, user, err := private.ServNoCommand(ctx, 1)
|
||||
require.NoError(t, err)
|
||||
|
@ -40,7 +40,7 @@ func TestAPIPrivateNoServ(t *testing.T) {
|
|||
|
||||
func TestAPIPrivateServ(t *testing.T) {
|
||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(t.Context())
|
||||
defer cancel()
|
||||
|
||||
// Can push to a repo we own
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
stdCtx "context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
@ -172,7 +171,7 @@ func TestAPICreateFile(t *testing.T) {
|
|||
req := NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/contents/%s", user2.Name, repo1.Name, treePath), &createFileOptions).
|
||||
AddTokenAuth(token2)
|
||||
resp := MakeRequest(t, req, http.StatusCreated)
|
||||
gitRepo, _ := gitrepo.OpenRepository(stdCtx.Background(), repo1)
|
||||
gitRepo, _ := gitrepo.OpenRepository(t.Context(), repo1)
|
||||
commitID, _ := gitRepo.GetBranchCommitID(createFileOptions.NewBranchName)
|
||||
latestCommit, _ := gitRepo.GetCommitByPath(treePath)
|
||||
expectedFileResponse := getExpectedFileResponseForCreate("user2/repo1", commitID, treePath, latestCommit.ID.String())
|
||||
|
@ -292,7 +291,7 @@ func TestAPICreateFile(t *testing.T) {
|
|||
AddTokenAuth(token2)
|
||||
resp = MakeRequest(t, req, http.StatusCreated)
|
||||
emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{OwnerName: "user2", Name: reponame}) // public repo
|
||||
gitRepo, _ := gitrepo.OpenRepository(stdCtx.Background(), emptyRepo)
|
||||
gitRepo, _ := gitrepo.OpenRepository(t.Context(), emptyRepo)
|
||||
commitID, _ := gitRepo.GetBranchCommitID(createFileOptions.NewBranchName)
|
||||
latestCommit, _ := gitRepo.GetCommitByPath(treePath)
|
||||
expectedFileResponse := getExpectedFileResponseForCreate("user2/"+reponame, commitID, treePath, latestCommit.ID.String())
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
stdCtx "context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
@ -135,7 +134,7 @@ func TestAPIUpdateFile(t *testing.T) {
|
|||
req := NewRequestWithJSON(t, "PUT", fmt.Sprintf("/api/v1/repos/%s/%s/contents/%s", user2.Name, repo1.Name, treePath), &updateFileOptions).
|
||||
AddTokenAuth(token2)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
gitRepo, _ := gitrepo.OpenRepository(stdCtx.Background(), repo1)
|
||||
gitRepo, _ := gitrepo.OpenRepository(t.Context(), repo1)
|
||||
commitID, _ := gitRepo.GetBranchCommitID(updateFileOptions.NewBranchName)
|
||||
lasCommit, _ := gitRepo.GetCommitByPath(treePath)
|
||||
expectedFileResponse := getExpectedFileResponseForUpdate(commitID, treePath, lasCommit.ID.String())
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
stdCtx "context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
@ -96,7 +95,7 @@ func TestAPIChangeFiles(t *testing.T) {
|
|||
req := NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/contents", user2.Name, repo1.Name), &changeFilesOptions).
|
||||
AddTokenAuth(token2)
|
||||
resp := MakeRequest(t, req, http.StatusCreated)
|
||||
gitRepo, _ := gitrepo.OpenRepository(stdCtx.Background(), repo1)
|
||||
gitRepo, _ := gitrepo.OpenRepository(t.Context(), repo1)
|
||||
commitID, _ := gitRepo.GetBranchCommitID(changeFilesOptions.NewBranchName)
|
||||
createLasCommit, _ := gitRepo.GetCommitByPath(createTreePath)
|
||||
updateLastCommit, _ := gitRepo.GetCommitByPath(updateTreePath)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
@ -320,7 +319,7 @@ func TestAPIEditOtherWikiPage(t *testing.T) {
|
|||
testCreateWiki(http.StatusForbidden)
|
||||
|
||||
// Update the repo settings for user2's repo to enable globally writeable wiki
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
var units []repo_model.RepoUnit
|
||||
units = append(units, repo_model.RepoUnit{
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -244,7 +243,7 @@ func TestLDAPUserSync(t *testing.T) {
|
|||
}
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
addAuthSourceLDAP(t, "", "", "", "")
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
|
||||
// Check if users exists
|
||||
for _, gitLDAPUser := range gitLDAPUsers {
|
||||
|
@ -296,7 +295,7 @@ func TestLDAPUserSyncWithEmptyUsernameAttribute(t *testing.T) {
|
|||
MakeRequest(t, req, http.StatusSeeOther)
|
||||
}
|
||||
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
|
||||
authSource := unittest.AssertExistsAndLoadBean(t, &auth_model.Source{
|
||||
Name: payload["name"],
|
||||
|
@ -331,7 +330,7 @@ func TestLDAPUserSyncWithGroupFilter(t *testing.T) {
|
|||
u := otherLDAPUsers[0]
|
||||
testLoginFailed(t, u.UserName, u.Password, translation.NewLocale("en-US").TrString("form.username_password_incorrect"))
|
||||
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
|
||||
// Assert members of LDAP group "cn=git" are added
|
||||
for _, gitLDAPUser := range gitLDAPUsers {
|
||||
|
@ -354,7 +353,7 @@ func TestLDAPUserSyncWithGroupFilter(t *testing.T) {
|
|||
ldapConfig.GroupFilter = "(cn=ship_crew)"
|
||||
auth_model.UpdateSource(db.DefaultContext, ldapSource)
|
||||
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
|
||||
for _, gitLDAPUser := range gitLDAPUsers {
|
||||
if gitLDAPUser.UserName == "fry" || gitLDAPUser.UserName == "leela" || gitLDAPUser.UserName == "bender" {
|
||||
|
@ -393,7 +392,7 @@ func TestLDAPUserSSHKeySync(t *testing.T) {
|
|||
defer tests.PrepareTestEnv(t)()
|
||||
addAuthSourceLDAP(t, "sshPublicKey", "", "", "")
|
||||
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
|
||||
// Check if users has SSH keys synced
|
||||
for _, u := range gitLDAPUsers {
|
||||
|
@ -429,7 +428,7 @@ func TestLDAPGroupTeamSyncAddMember(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
team, err := organization.GetTeam(db.DefaultContext, org.ID, "team11")
|
||||
require.NoError(t, err)
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
for _, gitLDAPUser := range gitLDAPUsers {
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
Name: gitLDAPUser.UserName,
|
||||
|
@ -518,7 +517,7 @@ func TestLDAPUserSyncInvalidMail(t *testing.T) {
|
|||
}
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
addAuthSourceLDAP(t, "", "nonexisting", "", "")
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
|
||||
// Check if users exists
|
||||
for _, gitLDAPUser := range gitLDAPUsers {
|
||||
|
@ -544,7 +543,7 @@ func TestLDAPUserSyncInvalidMailDefaultDomain(t *testing.T) {
|
|||
}
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
addAuthSourceLDAP(t, "", "nonexisting", "test.org", "")
|
||||
auth.SyncExternalUsers(context.Background(), true)
|
||||
auth.SyncExternalUsers(t.Context(), true)
|
||||
|
||||
// Check if users exists
|
||||
for _, gitLDAPUser := range gitLDAPUsers {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
gocontext "context"
|
||||
"io"
|
||||
"net/url"
|
||||
"os"
|
||||
|
@ -189,7 +188,7 @@ func Test_CmdForgejo_Actions(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
if assert.EqualValues(t, testCase.uuid, uuid) {
|
||||
ownerName, repoName, found := strings.Cut(testCase.scope, "/")
|
||||
action, err := actions_model.GetRunnerByUUID(gocontext.Background(), uuid)
|
||||
action, err := actions_model.GetRunnerByUUID(t.Context(), uuid)
|
||||
require.NoError(t, err)
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: action.OwnerID})
|
||||
|
|
|
@ -59,7 +59,7 @@ func TestF3_CmdMirror_LocalForgejo(t *testing.T) {
|
|||
defer tests.PrepareTestEnv(t)()
|
||||
defer test.MockVariableValue(&setting.F3.Enabled, true)()
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
mirrorOptions := f3_tests_forge.GetFactory(options.Name)().NewOptions(t)
|
||||
mirrorTree := f3_generic.GetFactory("f3")(ctx, mirrorOptions)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -48,7 +47,7 @@ func TestCodeOwner(t *testing.T) {
|
|||
r := fmt.Sprintf("%suser2/%s.git", u.String(), repo.Name)
|
||||
cloneURL, _ := url.Parse(r)
|
||||
cloneURL.User = url.UserPassword("user2", userPassword)
|
||||
require.NoError(t, git.CloneWithArgs(context.Background(), nil, cloneURL.String(), dstPath, git.CloneRepoOptions{}))
|
||||
require.NoError(t, git.CloneWithArgs(t.Context(), nil, cloneURL.String(), dstPath, git.CloneRepoOptions{}))
|
||||
|
||||
t.Run("Normal", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
@ -21,7 +20,6 @@ import (
|
|||
base "code.gitea.io/gitea/modules/migration"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/services/migrations"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -45,9 +43,7 @@ func TestDumpRestore(t *testing.T) {
|
|||
|
||||
reponame := "repo1"
|
||||
|
||||
basePath, err := os.MkdirTemp("", reponame)
|
||||
require.NoError(t, err)
|
||||
defer util.RemoveAll(basePath)
|
||||
basePath := t.TempDir()
|
||||
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: reponame})
|
||||
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID})
|
||||
|
@ -58,7 +54,7 @@ func TestDumpRestore(t *testing.T) {
|
|||
// Phase 1: dump repo1 from the Gitea instance to the filesystem
|
||||
//
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
opts := migrations.MigrateOptions{
|
||||
GitServiceType: structs.GiteaService,
|
||||
Issues: true,
|
||||
|
@ -70,7 +66,7 @@ func TestDumpRestore(t *testing.T) {
|
|||
CloneAddr: repo.CloneLink().HTTPS,
|
||||
RepoName: reponame,
|
||||
}
|
||||
err = migrations.DumpRepository(ctx, basePath, repoOwner.Name, opts)
|
||||
err := migrations.DumpRepository(ctx, basePath, repoOwner.Name, opts)
|
||||
require.NoError(t, err)
|
||||
|
||||
//
|
||||
|
|
|
@ -101,7 +101,7 @@ func onGiteaRun[T testing.TB](t T, callback func(T, *url.URL)) {
|
|||
func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Helper()
|
||||
require.NoError(t, git.CloneWithArgs(context.Background(), git.AllowLFSFiltersArgs(), u.String(), dstLocalPath, git.CloneRepoOptions{}))
|
||||
require.NoError(t, git.CloneWithArgs(t.Context(), git.AllowLFSFiltersArgs(), u.String(), dstLocalPath, git.CloneRepoOptions{}))
|
||||
exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md"))
|
||||
require.NoError(t, err)
|
||||
assert.True(t, exist)
|
||||
|
@ -111,7 +111,7 @@ func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
|
|||
func doPartialGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
t.Helper()
|
||||
require.NoError(t, git.CloneWithArgs(context.Background(), git.AllowLFSFiltersArgs(), u.String(), dstLocalPath, git.CloneRepoOptions{
|
||||
require.NoError(t, git.CloneWithArgs(t.Context(), git.AllowLFSFiltersArgs(), u.String(), dstLocalPath, git.CloneRepoOptions{
|
||||
Filter: "blob:none",
|
||||
}))
|
||||
exist, err := util.IsExist(filepath.Join(dstLocalPath, "README.md"))
|
||||
|
|
|
@ -347,7 +347,7 @@ func authSourcePayloadGitHubCustom(name string) map[string]string {
|
|||
}
|
||||
|
||||
func createRemoteAuthSource(t *testing.T, name, url, matchingSource string) *auth.Source {
|
||||
require.NoError(t, auth.CreateSource(context.Background(), &auth.Source{
|
||||
require.NoError(t, auth.CreateSource(t.Context(), &auth.Source{
|
||||
Type: auth.Remote,
|
||||
Name: name,
|
||||
IsActive: true,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -120,7 +119,7 @@ func TestViewIssuesKeyword(t *testing.T) {
|
|||
RepoID: repo.ID,
|
||||
Index: 1,
|
||||
})
|
||||
issues.UpdateIssueIndexer(context.Background(), issue.ID)
|
||||
issues.UpdateIssueIndexer(t.Context(), issue.ID)
|
||||
time.Sleep(time.Second * 1)
|
||||
|
||||
const keyword = "first"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
@ -158,7 +157,7 @@ func TestLFSLockView(t *testing.T) {
|
|||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
// make sure the display names are different, or the test is meaningless
|
||||
require.NoError(t, repo3.LoadOwner(context.Background()))
|
||||
require.NoError(t, repo3.LoadOwner(t.Context()))
|
||||
require.NotEqual(t, user2.DisplayName(), repo3.Owner.DisplayName())
|
||||
|
||||
req := NewRequest(t, "GET", fmt.Sprintf("/%s/settings/lfs/locks", repo3.FullName()))
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
@ -82,7 +81,7 @@ func TestLinguistSupport(t *testing.T) {
|
|||
err := stats.UpdateRepoIndexer(repo)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NoError(t, queue.GetManager().FlushAll(context.Background(), 10*time.Second))
|
||||
require.NoError(t, queue.GetManager().FlushAll(t.Context(), 10*time.Second))
|
||||
|
||||
status, err := repo_model.GetIndexerStatus(db.DefaultContext, repo, repo_model.RepoIndexerTypeStats)
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -5,7 +5,6 @@ package migrations
|
|||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -87,7 +86,7 @@ func initMigrationTest(t *testing.T) func() {
|
|||
}
|
||||
}
|
||||
|
||||
require.NoError(t, git.InitFull(context.Background()))
|
||||
require.NoError(t, git.InitFull(t.Context()))
|
||||
setting.LoadDBSetting()
|
||||
setting.InitLoggersForTest()
|
||||
return deferFn
|
||||
|
@ -279,13 +278,13 @@ func doMigrationTest(t *testing.T, version string) {
|
|||
|
||||
setting.InitSQLLoggersForCli(log.INFO)
|
||||
|
||||
err := db.InitEngineWithMigration(context.Background(), wrappedMigrate)
|
||||
err := db.InitEngineWithMigration(t.Context(), wrappedMigrate)
|
||||
require.NoError(t, err)
|
||||
currentEngine.Close()
|
||||
|
||||
beans, _ := db.NamesToBean()
|
||||
|
||||
err = db.InitEngineWithMigration(context.Background(), func(x *xorm.Engine) error {
|
||||
err = db.InitEngineWithMigration(t.Context(), func(x *xorm.Engine) error {
|
||||
currentEngine = x
|
||||
return migrate_base.RecreateTables(beans...)(x)
|
||||
})
|
||||
|
@ -293,7 +292,7 @@ func doMigrationTest(t *testing.T, version string) {
|
|||
currentEngine.Close()
|
||||
|
||||
// We do this a second time to ensure that there is not a problem with retained indices
|
||||
err = db.InitEngineWithMigration(context.Background(), func(x *xorm.Engine) error {
|
||||
err = db.InitEngineWithMigration(t.Context(), func(x *xorm.Engine) error {
|
||||
currentEngine = x
|
||||
return migrate_base.RecreateTables(beans...)(x)
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
|
@ -50,7 +49,7 @@ func TestMirrorPull(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
assert.True(t, mirrorRepo.IsMirror, "expected pull-mirror repo to be marked as a mirror immediately after its creation")
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
mirror, err := repo_service.MigrateRepositoryGitData(ctx, user, mirrorRepo, opts, nil)
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -66,7 +65,7 @@ func testMirrorPush(t *testing.T, u *url.URL) {
|
|||
require.NoError(t, err)
|
||||
assert.Len(t, mirrors, 2)
|
||||
|
||||
ok := mirror_service.SyncPushMirror(context.Background(), mirrors[0].ID)
|
||||
ok := mirror_service.SyncPushMirror(t.Context(), mirrors[0].ID)
|
||||
assert.True(t, ok)
|
||||
|
||||
srcGitRepo, err := gitrepo.OpenRepository(git.DefaultContext, srcRepo)
|
||||
|
|
|
@ -5,7 +5,6 @@ package integration
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
@ -518,7 +517,7 @@ func TestSignInOAuthCallbackSignIn(t *testing.T) {
|
|||
LoginSource: gitlab.ID,
|
||||
LoginName: userGitLabUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, userGitLab)()
|
||||
defer createUser(t.Context(), t, userGitLab)()
|
||||
|
||||
//
|
||||
// A request for user information sent to Goth will return a
|
||||
|
@ -556,7 +555,7 @@ func TestSignInOAuthCallbackWithoutPKCEWhenUnsupported(t *testing.T) {
|
|||
LoginSource: gitlab.ID,
|
||||
LoginName: userGitLabUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, userGitLab)()
|
||||
defer createUser(t.Context(), t, userGitLab)()
|
||||
|
||||
// initial redirection (to generate the code_challenge)
|
||||
session := emptyTestSession(t)
|
||||
|
@ -598,7 +597,7 @@ func TestSignInOAuthCallbackPKCE(t *testing.T) {
|
|||
LoginSource: authSource.ID,
|
||||
LoginName: userID,
|
||||
}
|
||||
defer createUser(context.Background(), t, user)()
|
||||
defer createUser(t.Context(), t, user)()
|
||||
|
||||
// initial redirection (to generate the code_challenge)
|
||||
session := emptyTestSession(t)
|
||||
|
@ -656,7 +655,7 @@ func TestSignInOAuthCallbackRedirectToEscaping(t *testing.T) {
|
|||
LoginSource: gitlab.ID,
|
||||
LoginName: userGitLabUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, userGitLab)()
|
||||
defer createUser(t.Context(), t, userGitLab)()
|
||||
|
||||
//
|
||||
// A request for user information sent to Goth will return a
|
||||
|
@ -731,7 +730,7 @@ func TestSignInOauthCallbackSyncSSHKeys(t *testing.T) {
|
|||
LoginName: userID,
|
||||
IsActive: true,
|
||||
}
|
||||
defer createUser(context.Background(), t, user)()
|
||||
defer createUser(t.Context(), t, user)()
|
||||
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
|
|
|
@ -5,7 +5,6 @@ package integration
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -303,11 +302,11 @@ func TestCantMergeConflict(t *testing.T) {
|
|||
gitRepo, err := gitrepo.OpenRepository(git.DefaultContext, repo1)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = pull.Merge(context.Background(), pr, user1, gitRepo, repo_model.MergeStyleMerge, "", "CONFLICT", false)
|
||||
err = pull.Merge(t.Context(), pr, user1, gitRepo, repo_model.MergeStyleMerge, "", "CONFLICT", false)
|
||||
require.Error(t, err, "Merge should return an error due to conflict")
|
||||
assert.True(t, models.IsErrMergeConflicts(err), "Merge error is not a conflict error")
|
||||
|
||||
err = pull.Merge(context.Background(), pr, user1, gitRepo, repo_model.MergeStyleRebase, "", "CONFLICT", false)
|
||||
err = pull.Merge(t.Context(), pr, user1, gitRepo, repo_model.MergeStyleRebase, "", "CONFLICT", false)
|
||||
require.Error(t, err, "Merge should return an error due to conflict")
|
||||
assert.True(t, models.IsErrRebaseConflicts(err), "Merge error is not a conflict error")
|
||||
gitRepo.Close()
|
||||
|
@ -402,7 +401,7 @@ func TestCantMergeUnrelated(t *testing.T) {
|
|||
BaseBranch: "base",
|
||||
})
|
||||
|
||||
err = pull.Merge(context.Background(), pr, user1, gitRepo, repo_model.MergeStyleMerge, "", "UNRELATED", false)
|
||||
err = pull.Merge(t.Context(), pr, user1, gitRepo, repo_model.MergeStyleMerge, "", "UNRELATED", false)
|
||||
require.Error(t, err, "Merge should return an error due to unrelated")
|
||||
assert.True(t, models.IsErrMergeUnrelatedHistories(err), "Merge error is not a unrelated histories error")
|
||||
gitRepo.Close()
|
||||
|
@ -442,7 +441,7 @@ func TestFastForwardOnlyMerge(t *testing.T) {
|
|||
gitRepo, err := git.OpenRepository(git.DefaultContext, repo_model.RepoPath(user1.Name, repo1.Name))
|
||||
require.NoError(t, err)
|
||||
|
||||
err = pull.Merge(context.Background(), pr, user1, gitRepo, repo_model.MergeStyleFastForwardOnly, "", "FAST-FORWARD-ONLY", false)
|
||||
err = pull.Merge(t.Context(), pr, user1, gitRepo, repo_model.MergeStyleFastForwardOnly, "", "FAST-FORWARD-ONLY", false)
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -484,7 +483,7 @@ func TestCantFastForwardOnlyMergeDiverging(t *testing.T) {
|
|||
gitRepo, err := git.OpenRepository(git.DefaultContext, repo_model.RepoPath(user1.Name, repo1.Name))
|
||||
require.NoError(t, err)
|
||||
|
||||
err = pull.Merge(context.Background(), pr, user1, gitRepo, repo_model.MergeStyleFastForwardOnly, "", "DIVERGING", false)
|
||||
err = pull.Merge(t.Context(), pr, user1, gitRepo, repo_model.MergeStyleFastForwardOnly, "", "DIVERGING", false)
|
||||
|
||||
require.Error(t, err, "Merge should return an error due to being for a diverging branch")
|
||||
assert.True(t, models.IsErrMergeDivergingFastForwardOnly(err), "Merge error is not a diverging fast-forward-only error")
|
||||
|
@ -633,7 +632,7 @@ func TestPullMergeIndexerNotifier(t *testing.T) {
|
|||
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n")
|
||||
createPullResp := testPullCreate(t, session, "user1", "repo1", false, "master", "master", "Indexer notifier test pull")
|
||||
|
||||
require.NoError(t, queue.GetManager().FlushAll(context.Background(), 0))
|
||||
require.NoError(t, queue.GetManager().FlushAll(t.Context(), 0))
|
||||
time.Sleep(time.Second)
|
||||
|
||||
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{
|
||||
|
@ -672,7 +671,7 @@ func TestPullMergeIndexerNotifier(t *testing.T) {
|
|||
})
|
||||
assert.True(t, issue.IsClosed)
|
||||
|
||||
require.NoError(t, queue.GetManager().FlushAll(context.Background(), 0))
|
||||
require.NoError(t, queue.GetManager().FlushAll(t.Context(), 0))
|
||||
time.Sleep(time.Second)
|
||||
|
||||
// search issues again
|
||||
|
@ -692,7 +691,7 @@ func testResetRepo(t *testing.T, repoPath, branch, commitID string) {
|
|||
require.NoError(t, err)
|
||||
f.Close()
|
||||
|
||||
repo, err := git.OpenRepository(context.Background(), repoPath)
|
||||
repo, err := git.OpenRepository(t.Context(), repoPath)
|
||||
require.NoError(t, err)
|
||||
defer repo.Close()
|
||||
id, err := repo.GetBranchCommitID(branch)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -100,7 +99,7 @@ func TestPullRequestSynchronized(t *testing.T) {
|
|||
logChecker.Filter("Updating PR").StopMark("TestPullRequest ")
|
||||
defer cleanup()
|
||||
|
||||
pull_service.TestPullRequest(context.Background(), owner, repo.ID, testCase.olderThan, "branch2", true, pull.HeadCommitID, pull.HeadCommitID)
|
||||
pull_service.TestPullRequest(t.Context(), owner, repo.ID, testCase.olderThan, "branch2", true, pull.HeadCommitID, pull.HeadCommitID)
|
||||
logFiltered, logStopped := logChecker.Check(5 * time.Second)
|
||||
assert.True(t, logStopped)
|
||||
assert.Equal(t, testCase.expected, logFiltered[0])
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -179,7 +178,7 @@ func TestPullView_ResolveInvalidatedReviewComment(t *testing.T) {
|
|||
// (to invalidate it properly, one should push a commit which should trigger this logic,
|
||||
// in the meantime, use this quick-and-dirty trick)
|
||||
comment := loadComment(t, commentID)
|
||||
require.NoError(t, issues_model.UpdateCommentInvalidate(context.Background(), &issues_model.Comment{
|
||||
require.NoError(t, issues_model.UpdateCommentInvalidate(t.Context(), &issues_model.Comment{
|
||||
ID: comment.ID,
|
||||
Invalidated: true,
|
||||
}))
|
||||
|
@ -241,7 +240,7 @@ func TestPullView_ResolveInvalidatedReviewComment(t *testing.T) {
|
|||
// (to invalidate it properly, one should push a commit which should trigger this logic,
|
||||
// in the meantime, use this quick-and-dirty trick)
|
||||
comment := loadComment(t, commentID)
|
||||
require.NoError(t, issues_model.UpdateCommentInvalidate(context.Background(), &issues_model.Comment{
|
||||
require.NoError(t, issues_model.UpdateCommentInvalidate(t.Context(), &issues_model.Comment{
|
||||
ID: comment.ID,
|
||||
Invalidated: true,
|
||||
}))
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
@ -48,7 +47,7 @@ func TestRemote_MaybePromoteUserSuccess(t *testing.T) {
|
|||
LoginSource: remote.ID,
|
||||
LoginName: gitlabUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, userBeforeSignIn)()
|
||||
defer createUser(t.Context(), t, userBeforeSignIn)()
|
||||
|
||||
//
|
||||
// A request for user information sent to Goth will return a
|
||||
|
@ -81,7 +80,7 @@ func TestRemote_MaybePromoteUserSuccess(t *testing.T) {
|
|||
func TestRemote_MaybePromoteUserFail(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
//
|
||||
// OAuth2 authentication source GitLab
|
||||
//
|
||||
|
@ -126,7 +125,7 @@ func TestRemote_MaybePromoteUserFail(t *testing.T) {
|
|||
LoginName: remoteUserID,
|
||||
Email: "some@example.com",
|
||||
}
|
||||
defer createUser(context.Background(), t, remoteUser)()
|
||||
defer createUser(t.Context(), t, remoteUser)()
|
||||
promoted, reason, err := remote_service.MaybePromoteRemoteUser(ctx, gitlabSource, remoteUserID, "")
|
||||
require.NoError(t, err)
|
||||
assert.False(t, promoted)
|
||||
|
@ -143,7 +142,7 @@ func TestRemote_MaybePromoteUserFail(t *testing.T) {
|
|||
LoginSource: nonexistentloginsource,
|
||||
LoginName: remoteUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, remoteUser)()
|
||||
defer createUser(t.Context(), t, remoteUser)()
|
||||
promoted, reason, err := remote_service.MaybePromoteRemoteUser(ctx, gitlabSource, remoteUserID, "")
|
||||
require.NoError(t, err)
|
||||
assert.False(t, promoted)
|
||||
|
@ -159,7 +158,7 @@ func TestRemote_MaybePromoteUserFail(t *testing.T) {
|
|||
LoginSource: gitlabSource.ID,
|
||||
LoginName: remoteUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, remoteUser)()
|
||||
defer createUser(t.Context(), t, remoteUser)()
|
||||
promoted, reason, err := remote_service.MaybePromoteRemoteUser(ctx, gitlabSource, remoteUserID, "")
|
||||
require.NoError(t, err)
|
||||
assert.False(t, promoted)
|
||||
|
@ -180,7 +179,7 @@ func TestRemote_MaybePromoteUserFail(t *testing.T) {
|
|||
LoginSource: remoteSource.ID,
|
||||
LoginName: remoteUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, remoteUser)()
|
||||
defer createUser(t.Context(), t, remoteUser)()
|
||||
promoted, reason, err := remote_service.MaybePromoteRemoteUser(ctx, unrelatedSource, remoteUserID, remoteEmail)
|
||||
require.NoError(t, err)
|
||||
assert.False(t, promoted)
|
||||
|
@ -197,7 +196,7 @@ func TestRemote_MaybePromoteUserFail(t *testing.T) {
|
|||
LoginSource: remoteSource.ID,
|
||||
LoginName: remoteUserID,
|
||||
}
|
||||
defer createUser(context.Background(), t, remoteUser)()
|
||||
defer createUser(t.Context(), t, remoteUser)()
|
||||
promoted, reason, err := remote_service.MaybePromoteRemoteUser(ctx, gitlabSource, remoteUserID, remoteEmail)
|
||||
require.NoError(t, err)
|
||||
assert.True(t, promoted)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -42,7 +41,7 @@ func TestRepoCloneWiki(t *testing.T) {
|
|||
u, _ = url.Parse(r)
|
||||
u.User = url.UserPassword("user2", userPassword)
|
||||
t.Run("Clone", func(t *testing.T) {
|
||||
require.NoError(t, git.CloneWithArgs(context.Background(), git.AllowLFSFiltersArgs(), u.String(), dstPath, git.CloneRepoOptions{}))
|
||||
require.NoError(t, git.CloneWithArgs(t.Context(), git.AllowLFSFiltersArgs(), u.String(), dstPath, git.CloneRepoOptions{}))
|
||||
assertFileEqual(t, filepath.Join(dstPath, "Home.md"), []byte("# Home page\n\nThis is the home page!\n"))
|
||||
assertFileExist(t, filepath.Join(dstPath, "Page-With-Image.md"))
|
||||
assertFileExist(t, filepath.Join(dstPath, "Page-With-Spaced-Name.md"))
|
||||
|
|
|
@ -267,9 +267,7 @@ func cancelProcesses(t testing.TB, delay time.Duration) {
|
|||
}
|
||||
|
||||
func PrepareGitRepoDirectory(t testing.TB) {
|
||||
var err error
|
||||
setting.RepoRootPath, err = os.MkdirTemp(t.TempDir(), "forgejo-repo-rooth")
|
||||
require.NoError(t, err)
|
||||
setting.RepoRootPath = t.TempDir()
|
||||
require.NoError(t, unittest.CopyDir(preparedDir, setting.RepoRootPath))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue