loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'test: even more sha256 repositories tests' (#3856) from oliverpool/forgejo:push_create_sha256 into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3856
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>

+69 -62
+69 -62
tests/integration/git_test.go
··· 56 56 forkedUserCtx := NewAPITestContext(t, "user4", "repo1", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 57 57 58 58 t.Run("HTTP", func(t *testing.T) { 59 - defer tests.PrintCurrentTest(t)() 60 59 ensureAnonymousClone(t, u) 61 - httpContext := baseAPITestContext 62 - httpContext.Reponame = "repo-tmp-17" 63 - forkedUserCtx.Reponame = httpContext.Reponame 60 + forEachObjectFormat(t, func(t *testing.T, objectFormat git.ObjectFormat) { 61 + defer tests.PrintCurrentTest(t)() 62 + httpContext := baseAPITestContext 63 + httpContext.Reponame = "repo-tmp-17-" + objectFormat.Name() 64 + forkedUserCtx.Reponame = httpContext.Reponame 64 65 65 - dstPath := t.TempDir() 66 + dstPath := t.TempDir() 66 67 67 - t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 68 - t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, httpContext.Username, perm.AccessModeRead)) 68 + t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false, objectFormat)) 69 + t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, httpContext.Username, perm.AccessModeRead)) 69 70 70 - t.Run("ForkFromDifferentUser", doAPIForkRepository(httpContext, forkedUserCtx.Username)) 71 + t.Run("ForkFromDifferentUser", doAPIForkRepository(httpContext, forkedUserCtx.Username)) 71 72 72 - u.Path = httpContext.GitPath() 73 - u.User = url.UserPassword(username, userPassword) 73 + u.Path = httpContext.GitPath() 74 + u.User = url.UserPassword(username, userPassword) 74 75 75 - t.Run("Clone", doGitClone(dstPath, u)) 76 + t.Run("Clone", doGitClone(dstPath, u)) 76 77 77 - dstPath2 := t.TempDir() 78 + dstPath2 := t.TempDir() 78 79 79 - t.Run("Partial Clone", doPartialGitClone(dstPath2, u)) 80 + t.Run("Partial Clone", doPartialGitClone(dstPath2, u)) 80 81 81 - little, big := standardCommitAndPushTest(t, dstPath) 82 - littleLFS, bigLFS := lfsCommitAndPushTest(t, dstPath) 83 - rawTest(t, &httpContext, little, big, littleLFS, bigLFS) 84 - mediaTest(t, &httpContext, little, big, littleLFS, bigLFS) 82 + little, big := standardCommitAndPushTest(t, dstPath) 83 + littleLFS, bigLFS := lfsCommitAndPushTest(t, dstPath) 84 + rawTest(t, &httpContext, little, big, littleLFS, bigLFS) 85 + mediaTest(t, &httpContext, little, big, littleLFS, bigLFS) 86 + 87 + t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "test/head")) 88 + t.Run("InternalReferences", doInternalReferences(&httpContext, dstPath)) 89 + t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath)) 90 + t.Run("AutoMerge", doAutoPRMerge(&httpContext, dstPath)) 91 + t.Run("CreatePRAndSetManuallyMerged", doCreatePRAndSetManuallyMerged(httpContext, httpContext, dstPath, "master", "test-manually-merge")) 92 + t.Run("MergeFork", func(t *testing.T) { 93 + defer tests.PrintCurrentTest(t)() 94 + t.Run("CreatePRAndMerge", doMergeFork(httpContext, forkedUserCtx, "master", httpContext.Username+":master")) 95 + rawTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 96 + mediaTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 97 + }) 85 98 86 - t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "test/head")) 87 - t.Run("InternalReferences", doInternalReferences(&httpContext, dstPath)) 88 - t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath)) 89 - t.Run("AutoMerge", doAutoPRMerge(&httpContext, dstPath)) 90 - t.Run("CreatePRAndSetManuallyMerged", doCreatePRAndSetManuallyMerged(httpContext, httpContext, dstPath, "master", "test-manually-merge")) 91 - t.Run("MergeFork", func(t *testing.T) { 92 - defer tests.PrintCurrentTest(t)() 93 - t.Run("CreatePRAndMerge", doMergeFork(httpContext, forkedUserCtx, "master", httpContext.Username+":master")) 94 - rawTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 95 - mediaTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 99 + t.Run("PushCreate", doPushCreate(httpContext, u, objectFormat)) 96 100 }) 97 - 98 - t.Run("PushCreate", doPushCreate(httpContext, u)) 99 101 }) 100 102 t.Run("SSH", func(t *testing.T) { 101 - defer tests.PrintCurrentTest(t)() 102 - sshContext := baseAPITestContext 103 - sshContext.Reponame = "repo-tmp-18" 104 - keyname := "my-testing-key" 105 - forkedUserCtx.Reponame = sshContext.Reponame 106 - t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 107 - t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, sshContext.Username, perm.AccessModeRead)) 108 - t.Run("ForkFromDifferentUser", doAPIForkRepository(sshContext, forkedUserCtx.Username)) 103 + forEachObjectFormat(t, func(t *testing.T, objectFormat git.ObjectFormat) { 104 + defer tests.PrintCurrentTest(t)() 105 + sshContext := baseAPITestContext 106 + sshContext.Reponame = "repo-tmp-18-" + objectFormat.Name() 107 + keyname := "my-testing-key" 108 + forkedUserCtx.Reponame = sshContext.Reponame 109 + t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false, objectFormat)) 110 + t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, sshContext.Username, perm.AccessModeRead)) 111 + t.Run("ForkFromDifferentUser", doAPIForkRepository(sshContext, forkedUserCtx.Username)) 109 112 110 - // Setup key the user ssh key 111 - withKeyFile(t, keyname, func(keyFile string) { 112 - t.Run("CreateUserKey", doAPICreateUserKey(sshContext, "test-key", keyFile)) 113 + // Setup key the user ssh key 114 + withKeyFile(t, keyname, func(keyFile string) { 115 + t.Run("CreateUserKey", doAPICreateUserKey(sshContext, "test-key-"+objectFormat.Name(), keyFile)) 113 116 114 - // Setup remote link 115 - // TODO: get url from api 116 - sshURL := createSSHUrl(sshContext.GitPath(), u) 117 + // Setup remote link 118 + // TODO: get url from api 119 + sshURL := createSSHUrl(sshContext.GitPath(), u) 117 120 118 - // Setup clone folder 119 - dstPath := t.TempDir() 121 + // Setup clone folder 122 + dstPath := t.TempDir() 120 123 121 - t.Run("Clone", doGitClone(dstPath, sshURL)) 124 + t.Run("Clone", doGitClone(dstPath, sshURL)) 122 125 123 - little, big := standardCommitAndPushTest(t, dstPath) 124 - littleLFS, bigLFS := lfsCommitAndPushTest(t, dstPath) 125 - rawTest(t, &sshContext, little, big, littleLFS, bigLFS) 126 - mediaTest(t, &sshContext, little, big, littleLFS, bigLFS) 126 + little, big := standardCommitAndPushTest(t, dstPath) 127 + littleLFS, bigLFS := lfsCommitAndPushTest(t, dstPath) 128 + rawTest(t, &sshContext, little, big, littleLFS, bigLFS) 129 + mediaTest(t, &sshContext, little, big, littleLFS, bigLFS) 130 + 131 + t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &sshContext, "test/head2")) 132 + t.Run("InternalReferences", doInternalReferences(&sshContext, dstPath)) 133 + t.Run("BranchProtectMerge", doBranchProtectPRMerge(&sshContext, dstPath)) 134 + t.Run("MergeFork", func(t *testing.T) { 135 + defer tests.PrintCurrentTest(t)() 136 + t.Run("CreatePRAndMerge", doMergeFork(sshContext, forkedUserCtx, "master", sshContext.Username+":master")) 137 + rawTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 138 + mediaTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 139 + }) 127 140 128 - t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &sshContext, "test/head2")) 129 - t.Run("InternalReferences", doInternalReferences(&sshContext, dstPath)) 130 - t.Run("BranchProtectMerge", doBranchProtectPRMerge(&sshContext, dstPath)) 131 - t.Run("MergeFork", func(t *testing.T) { 132 - defer tests.PrintCurrentTest(t)() 133 - t.Run("CreatePRAndMerge", doMergeFork(sshContext, forkedUserCtx, "master", sshContext.Username+":master")) 134 - rawTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 135 - mediaTest(t, &forkedUserCtx, little, big, littleLFS, bigLFS) 141 + t.Run("PushCreate", doPushCreate(sshContext, sshURL, objectFormat)) 136 142 }) 137 - 138 - t.Run("PushCreate", doPushCreate(sshContext, sshURL)) 139 143 }) 140 144 }) 141 145 } ··· 586 590 } 587 591 } 588 592 589 - func doPushCreate(ctx APITestContext, u *url.URL) func(t *testing.T) { 593 + func doPushCreate(ctx APITestContext, u *url.URL, objectFormat git.ObjectFormat) func(t *testing.T) { 590 594 return func(t *testing.T) { 595 + if objectFormat == git.Sha256ObjectFormat { 596 + t.Skipf("push-create not supported for %s, see https://codeberg.org/forgejo/forgejo/issues/3783", objectFormat) 597 + } 591 598 defer tests.PrintCurrentTest(t)() 592 599 593 600 // create a context for a currently non-existent repository ··· 598 605 tmpDir := t.TempDir() 599 606 600 607 // Now create local repository to push as our test and set its origin 601 - t.Run("InitTestRepository", doGitInitTestRepository(tmpDir, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 608 + t.Run("InitTestRepository", doGitInitTestRepository(tmpDir, objectFormat)) 602 609 t.Run("AddRemote", doGitAddRemote(tmpDir, "origin", u)) 603 610 604 611 // Disable "Push To Create" and attempt to push