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: add more sha256 repositories tests' (#3794) from oliverpool/forgejo:push_deploy_sha256 into forgejo

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

+135 -118
+56 -54
tests/integration/api_branch_test.go
··· 11 11 auth_model "code.gitea.io/gitea/models/auth" 12 12 "code.gitea.io/gitea/models/db" 13 13 git_model "code.gitea.io/gitea/models/git" 14 + "code.gitea.io/gitea/modules/git" 14 15 api "code.gitea.io/gitea/modules/structs" 15 16 "code.gitea.io/gitea/tests" 16 17 ··· 110 111 } 111 112 112 113 func testAPICreateBranches(t *testing.T, giteaURL *url.URL) { 113 - username := "user2" 114 - ctx := NewAPITestContext(t, username, "my-noo-repo", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 115 - giteaURL.Path = ctx.GitPath() 114 + forEachObjectFormat(t, func(t *testing.T, objectFormat git.ObjectFormat) { 115 + ctx := NewAPITestContext(t, "user2", "my-noo-repo-"+objectFormat.Name(), auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 116 + giteaURL.Path = ctx.GitPath() 116 117 117 - t.Run("CreateRepo", doAPICreateRepository(ctx, false)) 118 - testCases := []struct { 119 - OldBranch string 120 - NewBranch string 121 - ExpectedHTTPStatus int 122 - }{ 123 - // Creating branch from default branch 124 - { 125 - OldBranch: "", 126 - NewBranch: "new_branch_from_default_branch", 127 - ExpectedHTTPStatus: http.StatusCreated, 128 - }, 129 - // Creating branch from master 130 - { 131 - OldBranch: "master", 132 - NewBranch: "new_branch_from_master_1", 133 - ExpectedHTTPStatus: http.StatusCreated, 134 - }, 135 - // Trying to create from master but already exists 136 - { 137 - OldBranch: "master", 138 - NewBranch: "new_branch_from_master_1", 139 - ExpectedHTTPStatus: http.StatusConflict, 140 - }, 141 - // Trying to create from other branch (not default branch) 142 - // ps: it can't test the case-sensitive behavior here: the "BRANCH_2" can't be created by git on a case-insensitive filesystem, it makes the test fail quickly before the database code. 143 - // Suppose some users are running Gitea on a case-insensitive filesystem, it seems that it's unable to support case-sensitive branch names. 144 - { 145 - OldBranch: "new_branch_from_master_1", 146 - NewBranch: "branch_2", 147 - ExpectedHTTPStatus: http.StatusCreated, 148 - }, 149 - // Trying to create from a branch which does not exist 150 - { 151 - OldBranch: "does_not_exist", 152 - NewBranch: "new_branch_from_non_existent", 153 - ExpectedHTTPStatus: http.StatusNotFound, 154 - }, 155 - // Trying to create a branch with UTF8 156 - { 157 - OldBranch: "master", 158 - NewBranch: "test-👀", 159 - ExpectedHTTPStatus: http.StatusCreated, 160 - }, 161 - } 162 - for _, test := range testCases { 163 - session := ctx.Session 164 - t.Run(test.NewBranch, func(t *testing.T) { 165 - testAPICreateBranch(t, session, "user2", "my-noo-repo", test.OldBranch, test.NewBranch, test.ExpectedHTTPStatus) 166 - }) 167 - } 118 + t.Run("CreateRepo", doAPICreateRepository(ctx, false, objectFormat)) 119 + testCases := []struct { 120 + OldBranch string 121 + NewBranch string 122 + ExpectedHTTPStatus int 123 + }{ 124 + // Creating branch from default branch 125 + { 126 + OldBranch: "", 127 + NewBranch: "new_branch_from_default_branch", 128 + ExpectedHTTPStatus: http.StatusCreated, 129 + }, 130 + // Creating branch from master 131 + { 132 + OldBranch: "master", 133 + NewBranch: "new_branch_from_master_1", 134 + ExpectedHTTPStatus: http.StatusCreated, 135 + }, 136 + // Trying to create from master but already exists 137 + { 138 + OldBranch: "master", 139 + NewBranch: "new_branch_from_master_1", 140 + ExpectedHTTPStatus: http.StatusConflict, 141 + }, 142 + // Trying to create from other branch (not default branch) 143 + // ps: it can't test the case-sensitive behavior here: the "BRANCH_2" can't be created by git on a case-insensitive filesystem, it makes the test fail quickly before the database code. 144 + // Suppose some users are running Gitea on a case-insensitive filesystem, it seems that it's unable to support case-sensitive branch names. 145 + { 146 + OldBranch: "new_branch_from_master_1", 147 + NewBranch: "branch_2", 148 + ExpectedHTTPStatus: http.StatusCreated, 149 + }, 150 + // Trying to create from a branch which does not exist 151 + { 152 + OldBranch: "does_not_exist", 153 + NewBranch: "new_branch_from_non_existent", 154 + ExpectedHTTPStatus: http.StatusNotFound, 155 + }, 156 + // Trying to create a branch with UTF8 157 + { 158 + OldBranch: "master", 159 + NewBranch: "test-👀", 160 + ExpectedHTTPStatus: http.StatusCreated, 161 + }, 162 + } 163 + for _, test := range testCases { 164 + session := ctx.Session 165 + t.Run(test.NewBranch, func(t *testing.T) { 166 + testAPICreateBranch(t, session, ctx.Username, ctx.Reponame, test.OldBranch, test.NewBranch, test.ExpectedHTTPStatus) 167 + }) 168 + } 169 + }) 168 170 } 169 171 170 172 func testAPICreateBranch(t testing.TB, session *TestSession, user, repo, oldBranch, newBranch string, status int) bool {
+11 -9
tests/integration/api_helper_for_declarative_test.go
··· 16 16 "code.gitea.io/gitea/models/auth" 17 17 "code.gitea.io/gitea/models/perm" 18 18 repo_model "code.gitea.io/gitea/models/repo" 19 + "code.gitea.io/gitea/modules/git" 19 20 "code.gitea.io/gitea/modules/json" 20 21 "code.gitea.io/gitea/modules/queue" 21 22 api "code.gitea.io/gitea/modules/structs" ··· 47 48 return fmt.Sprintf("%s/%s.git", ctx.Username, ctx.Reponame) 48 49 } 49 50 50 - func doAPICreateRepository(ctx APITestContext, empty bool, callback ...func(*testing.T, api.Repository)) func(*testing.T) { 51 + func doAPICreateRepository(ctx APITestContext, empty bool, objectFormat git.ObjectFormat, callback ...func(*testing.T, api.Repository)) func(*testing.T) { 51 52 return func(t *testing.T) { 52 53 createRepoOption := &api.CreateRepoOption{ 53 - AutoInit: !empty, 54 - Description: "Temporary repo", 55 - Name: ctx.Reponame, 56 - Private: true, 57 - Template: true, 58 - Gitignores: "", 59 - License: "WTFPL", 60 - Readme: "Default", 54 + AutoInit: !empty, 55 + Description: "Temporary repo", 56 + Name: ctx.Reponame, 57 + Private: true, 58 + Template: true, 59 + Gitignores: "", 60 + License: "WTFPL", 61 + Readme: "Default", 62 + ObjectFormatName: objectFormat.Name(), 61 63 } 62 64 req := NewRequestWithJSON(t, "POST", "/api/v1/user/repos", createRepoOption). 63 65 AddTokenAuth(ctx.Token)
+31 -23
tests/integration/api_repo_file_create_test.go
··· 17 17 repo_model "code.gitea.io/gitea/models/repo" 18 18 "code.gitea.io/gitea/models/unittest" 19 19 user_model "code.gitea.io/gitea/models/user" 20 + "code.gitea.io/gitea/modules/git" 20 21 "code.gitea.io/gitea/modules/gitrepo" 21 22 "code.gitea.io/gitea/modules/setting" 22 23 api "code.gitea.io/gitea/modules/structs" ··· 52 53 53 54 func getExpectedFileResponseForCreate(repoFullName, commitID, treePath, latestCommitSHA string) *api.FileResponse { 54 55 sha := "a635aa942442ddfdba07468cf9661c08fbdf0ebf" 56 + if len(latestCommitSHA) > len(sha) { 57 + // repository is in SHA256 format 58 + sha = "3edd190f61237b7a0a5c49aa47fb58b2ec14d53a2afc90803bc713fab5d5aec0" 59 + } 55 60 encoding := "base64" 56 61 content := "VGhpcyBpcyBuZXcgdGV4dA==" 57 62 selfURL := setting.AppURL + "api/v1/repos/" + repoFullName + "/contents/" + treePath + "?ref=master" ··· 277 282 MakeRequest(t, req, http.StatusForbidden) 278 283 279 284 // Test creating a file in an empty repository 280 - doAPICreateRepository(NewAPITestContext(t, "user2", "empty-repo", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser), true)(t) 281 - createFileOptions = getCreateFileOptions() 282 - fileID++ 283 - treePath = fmt.Sprintf("new/file%d.txt", fileID) 284 - req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/contents/%s", user2.Name, "empty-repo", treePath), &createFileOptions). 285 - AddTokenAuth(token2) 286 - resp = MakeRequest(t, req, http.StatusCreated) 287 - emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{OwnerName: "user2", Name: "empty-repo"}) // public repo 288 - gitRepo, _ := gitrepo.OpenRepository(stdCtx.Background(), emptyRepo) 289 - commitID, _ := gitRepo.GetBranchCommitID(createFileOptions.NewBranchName) 290 - latestCommit, _ := gitRepo.GetCommitByPath(treePath) 291 - expectedFileResponse := getExpectedFileResponseForCreate("user2/empty-repo", commitID, treePath, latestCommit.ID.String()) 292 - DecodeJSON(t, resp, &fileResponse) 293 - assert.EqualValues(t, expectedFileResponse.Content, fileResponse.Content) 294 - assert.EqualValues(t, expectedFileResponse.Commit.SHA, fileResponse.Commit.SHA) 295 - assert.EqualValues(t, expectedFileResponse.Commit.HTMLURL, fileResponse.Commit.HTMLURL) 296 - assert.EqualValues(t, expectedFileResponse.Commit.Author.Email, fileResponse.Commit.Author.Email) 297 - assert.EqualValues(t, expectedFileResponse.Commit.Author.Name, fileResponse.Commit.Author.Name) 298 - assert.EqualValues(t, expectedFileResponse.Commit.Author.Date, fileResponse.Commit.Author.Date) 299 - assert.EqualValues(t, expectedFileResponse.Commit.Committer.Email, fileResponse.Commit.Committer.Email) 300 - assert.EqualValues(t, expectedFileResponse.Commit.Committer.Name, fileResponse.Commit.Committer.Name) 301 - assert.EqualValues(t, expectedFileResponse.Commit.Committer.Date, fileResponse.Commit.Committer.Date) 302 - gitRepo.Close() 285 + forEachObjectFormat(t, func(t *testing.T, objectFormat git.ObjectFormat) { 286 + reponame := "empty-repo-" + objectFormat.Name() 287 + doAPICreateRepository(NewAPITestContext(t, "user2", reponame, auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser), true, objectFormat)(t) 288 + createFileOptions = getCreateFileOptions() 289 + fileID++ 290 + treePath = fmt.Sprintf("new/file%d.txt", fileID) 291 + req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/contents/%s", user2.Name, reponame, treePath), &createFileOptions). 292 + AddTokenAuth(token2) 293 + resp = MakeRequest(t, req, http.StatusCreated) 294 + emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{OwnerName: "user2", Name: reponame}) // public repo 295 + gitRepo, _ := gitrepo.OpenRepository(stdCtx.Background(), emptyRepo) 296 + commitID, _ := gitRepo.GetBranchCommitID(createFileOptions.NewBranchName) 297 + latestCommit, _ := gitRepo.GetCommitByPath(treePath) 298 + expectedFileResponse := getExpectedFileResponseForCreate("user2/"+reponame, commitID, treePath, latestCommit.ID.String()) 299 + DecodeJSON(t, resp, &fileResponse) 300 + assert.EqualValues(t, expectedFileResponse.Content, fileResponse.Content) 301 + assert.EqualValues(t, expectedFileResponse.Commit.SHA, fileResponse.Commit.SHA) 302 + assert.EqualValues(t, expectedFileResponse.Commit.HTMLURL, fileResponse.Commit.HTMLURL) 303 + assert.EqualValues(t, expectedFileResponse.Commit.Author.Email, fileResponse.Commit.Author.Email) 304 + assert.EqualValues(t, expectedFileResponse.Commit.Author.Name, fileResponse.Commit.Author.Name) 305 + assert.EqualValues(t, expectedFileResponse.Commit.Author.Date, fileResponse.Commit.Author.Date) 306 + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Email, fileResponse.Commit.Committer.Email) 307 + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Name, fileResponse.Commit.Committer.Name) 308 + assert.EqualValues(t, expectedFileResponse.Commit.Committer.Date, fileResponse.Commit.Committer.Date) 309 + gitRepo.Close() 310 + }) 303 311 }) 304 312 }
+2 -1
tests/integration/api_repo_file_get_test.go
··· 9 9 "testing" 10 10 11 11 auth_model "code.gitea.io/gitea/models/auth" 12 + "code.gitea.io/gitea/modules/git" 12 13 api "code.gitea.io/gitea/modules/structs" 13 14 "code.gitea.io/gitea/tests" 14 15 ··· 26 27 // Test with LFS 27 28 onGiteaRun(t, func(t *testing.T, u *url.URL) { 28 29 httpContext := NewAPITestContext(t, "user2", "repo-lfs-test", auth_model.AccessTokenScopeWriteRepository) 29 - doAPICreateRepository(httpContext, false, func(t *testing.T, repository api.Repository) { 30 + doAPICreateRepository(httpContext, false, git.Sha1ObjectFormat, func(t *testing.T, repository api.Repository) { // FIXME: use forEachObjectFormat 30 31 u.Path = httpContext.GitPath() 31 32 dstPath := t.TempDir() 32 33
+2 -1
tests/integration/api_repo_lfs_test.go
··· 17 17 repo_model "code.gitea.io/gitea/models/repo" 18 18 "code.gitea.io/gitea/models/unittest" 19 19 user_model "code.gitea.io/gitea/models/user" 20 + "code.gitea.io/gitea/modules/git" 20 21 "code.gitea.io/gitea/modules/json" 21 22 "code.gitea.io/gitea/modules/lfs" 22 23 "code.gitea.io/gitea/modules/setting" ··· 61 62 62 63 func createLFSTestRepository(t *testing.T, name string) *repo_model.Repository { 63 64 ctx := NewAPITestContext(t, "user2", "lfs-"+name+"-repo", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 64 - t.Run("CreateRepo", doAPICreateRepository(ctx, false)) 65 + t.Run("CreateRepo", doAPICreateRepository(ctx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 65 66 66 67 repo, err := repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, "user2", "lfs-"+name+"-repo") 67 68 assert.NoError(t, err)
+3 -2
tests/integration/api_repo_test.go
··· 16 16 unit_model "code.gitea.io/gitea/models/unit" 17 17 "code.gitea.io/gitea/models/unittest" 18 18 user_model "code.gitea.io/gitea/models/user" 19 + "code.gitea.io/gitea/modules/git" 19 20 "code.gitea.io/gitea/modules/setting" 20 21 api "code.gitea.io/gitea/modules/structs" 21 22 repo_service "code.gitea.io/gitea/services/repository" ··· 427 428 httpContext := baseAPITestContext 428 429 429 430 httpContext.Reponame = "repo-tmp-17" 430 - t.Run("CreateRepo", doAPICreateRepository(httpContext, false)) 431 + t.Run("CreateRepo", doAPICreateRepository(httpContext, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 431 432 432 433 user, err := user_model.GetUserByName(db.DefaultContext, httpContext.Username) 433 434 assert.NoError(t, err) ··· 510 511 httpContext := baseAPITestContext 511 512 512 513 httpContext.Reponame = "repo-tmp-17" 513 - t.Run("CreateRepo", doAPICreateRepository(httpContext, false)) 514 + t.Run("CreateRepo", doAPICreateRepository(httpContext, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 514 515 515 516 req := NewRequestWithJSON(t, "POST", "/api/v1/user/repos", 516 517 &api.CreateRepoOption{
+2 -2
tests/integration/git_test.go
··· 64 64 65 65 dstPath := t.TempDir() 66 66 67 - t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false)) 67 + t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 68 68 t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, httpContext.Username, perm.AccessModeRead)) 69 69 70 70 t.Run("ForkFromDifferentUser", doAPIForkRepository(httpContext, forkedUserCtx.Username)) ··· 103 103 sshContext.Reponame = "repo-tmp-18" 104 104 keyname := "my-testing-key" 105 105 forkedUserCtx.Reponame = sshContext.Reponame 106 - t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false)) 106 + t.Run("CreateRepoInDifferentUser", doAPICreateRepository(forkedUserCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 107 107 t.Run("AddUserAsCollaborator", doAPIAddCollaborator(forkedUserCtx, sshContext.Username, perm.AccessModeRead)) 108 108 t.Run("ForkFromDifferentUser", doAPIForkRepository(sshContext, forkedUserCtx.Username)) 109 109
+6 -5
tests/integration/gpg_git_test.go
··· 13 13 auth_model "code.gitea.io/gitea/models/auth" 14 14 "code.gitea.io/gitea/models/unittest" 15 15 user_model "code.gitea.io/gitea/models/user" 16 + "code.gitea.io/gitea/modules/git" 16 17 "code.gitea.io/gitea/modules/process" 17 18 "code.gitea.io/gitea/modules/setting" 18 19 api "code.gitea.io/gitea/modules/structs" ··· 56 57 t.Run("Unsigned-Initial", func(t *testing.T) { 57 58 defer tests.PrintCurrentTest(t)() 58 59 testCtx := NewAPITestContext(t, username, "initial-unsigned", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 59 - t.Run("CreateRepository", doAPICreateRepository(testCtx, false)) 60 + t.Run("CreateRepository", doAPICreateRepository(testCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 60 61 t.Run("CheckMasterBranchUnsigned", doAPIGetBranch(testCtx, "master", func(t *testing.T, branch api.Branch) { 61 62 assert.NotNil(t, branch.Commit) 62 63 assert.NotNil(t, branch.Commit.Verification) ··· 149 150 t.Run("AlwaysSign-Initial", func(t *testing.T) { 150 151 defer tests.PrintCurrentTest(t)() 151 152 testCtx := NewAPITestContext(t, username, "initial-always", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 152 - t.Run("CreateRepository", doAPICreateRepository(testCtx, false)) 153 + t.Run("CreateRepository", doAPICreateRepository(testCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 153 154 t.Run("CheckMasterBranchSigned", doAPIGetBranch(testCtx, "master", func(t *testing.T, branch api.Branch) { 154 155 assert.NotNil(t, branch.Commit) 155 156 if branch.Commit == nil { ··· 171 172 t.Run("AlwaysSign-Initial-CRUD-Never", func(t *testing.T) { 172 173 defer tests.PrintCurrentTest(t)() 173 174 testCtx := NewAPITestContext(t, username, "initial-always-never", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 174 - t.Run("CreateRepository", doAPICreateRepository(testCtx, false)) 175 + t.Run("CreateRepository", doAPICreateRepository(testCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 175 176 t.Run("CreateCRUDFile-Never", crudActionCreateFile( 176 177 t, testCtx, user, "master", "never", "unsigned-never.txt", func(t *testing.T, response api.FileResponse) { 177 178 assert.False(t, response.Verification.Verified) ··· 182 183 t.Run("AlwaysSign-Initial-CRUD-ParentSigned-On-Always", func(t *testing.T) { 183 184 defer tests.PrintCurrentTest(t)() 184 185 testCtx := NewAPITestContext(t, username, "initial-always-parent", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 185 - t.Run("CreateRepository", doAPICreateRepository(testCtx, false)) 186 + t.Run("CreateRepository", doAPICreateRepository(testCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 186 187 t.Run("CreateCRUDFile-ParentSigned", crudActionCreateFile( 187 188 t, testCtx, user, "master", "parentsigned", "signed-parent.txt", func(t *testing.T, response api.FileResponse) { 188 189 assert.True(t, response.Verification.Verified) ··· 198 199 t.Run("AlwaysSign-Initial-CRUD-Always", func(t *testing.T) { 199 200 defer tests.PrintCurrentTest(t)() 200 201 testCtx := NewAPITestContext(t, username, "initial-always-always", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 201 - t.Run("CreateRepository", doAPICreateRepository(testCtx, false)) 202 + t.Run("CreateRepository", doAPICreateRepository(testCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 202 203 t.Run("CreateCRUDFile-Always", crudActionCreateFile( 203 204 t, testCtx, user, "master", "always", "signed-always.txt", func(t *testing.T, response api.FileResponse) { 204 205 assert.True(t, response.Verification.Verified)
+22 -21
tests/integration/ssh_key_test.go
··· 47 47 } 48 48 49 49 func testPushDeployKeyOnEmptyRepo(t *testing.T, u *url.URL) { 50 - // OK login 51 - ctx := NewAPITestContext(t, "user2", "deploy-key-empty-repo-1", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 52 - ctxWithDeleteRepo := NewAPITestContext(t, "user2", "deploy-key-empty-repo-1", auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 50 + forEachObjectFormat(t, func(t *testing.T, objectFormat git.ObjectFormat) { 51 + // OK login 52 + ctx := NewAPITestContext(t, "user2", "deploy-key-empty-repo-"+objectFormat.Name(), auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteUser) 53 53 54 - keyname := fmt.Sprintf("%s-push", ctx.Reponame) 55 - u.Path = ctx.GitPath() 54 + keyname := fmt.Sprintf("%s-push", ctx.Reponame) 55 + u.Path = ctx.GitPath() 56 56 57 - t.Run("CreateEmptyRepository", doAPICreateRepository(ctx, true)) 57 + t.Run("CreateEmptyRepository", doAPICreateRepository(ctx, true, objectFormat)) 58 58 59 - t.Run("CheckIsEmpty", doCheckRepositoryEmptyStatus(ctx, true)) 59 + t.Run("CheckIsEmpty", doCheckRepositoryEmptyStatus(ctx, true)) 60 60 61 - withKeyFile(t, keyname, func(keyFile string) { 62 - t.Run("CreatePushDeployKey", doAPICreateDeployKey(ctx, keyname, keyFile, false)) 61 + withKeyFile(t, keyname, func(keyFile string) { 62 + t.Run("CreatePushDeployKey", doAPICreateDeployKey(ctx, keyname, keyFile, false)) 63 63 64 - // Setup the testing repository 65 - dstPath := t.TempDir() 64 + // Setup the testing repository 65 + dstPath := t.TempDir() 66 66 67 - t.Run("InitTestRepository", doGitInitTestRepository(dstPath, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 67 + t.Run("InitTestRepository", doGitInitTestRepository(dstPath, objectFormat)) 68 68 69 - // Setup remote link 70 - sshURL := createSSHUrl(ctx.GitPath(), u) 69 + // Setup remote link 70 + sshURL := createSSHUrl(ctx.GitPath(), u) 71 71 72 - t.Run("AddRemote", doGitAddRemote(dstPath, "origin", sshURL)) 72 + t.Run("AddRemote", doGitAddRemote(dstPath, "origin", sshURL)) 73 73 74 - t.Run("SSHPushTestRepository", doGitPushTestRepository(dstPath, "origin", "master")) 74 + t.Run("SSHPushTestRepository", doGitPushTestRepository(dstPath, "origin", "master")) 75 75 76 - t.Run("CheckIsNotEmpty", doCheckRepositoryEmptyStatus(ctx, false)) 76 + t.Run("CheckIsNotEmpty", doCheckRepositoryEmptyStatus(ctx, false)) 77 77 78 - t.Run("DeleteRepository", doAPIDeleteRepository(ctxWithDeleteRepo)) 78 + t.Run("DeleteRepository", doAPIDeleteRepository(ctx)) 79 + }) 79 80 }) 80 81 } 81 82 ··· 103 104 failCtx := ctx 104 105 failCtx.ExpectedCode = http.StatusUnprocessableEntity 105 106 106 - t.Run("CreateRepository", doAPICreateRepository(ctx, false)) 107 - t.Run("CreateOtherRepository", doAPICreateRepository(otherCtx, false)) 107 + t.Run("CreateRepository", doAPICreateRepository(ctx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 108 + t.Run("CreateOtherRepository", doAPICreateRepository(otherCtx, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 108 109 109 110 withKeyFile(t, keyname, func(keyFile string) { 110 111 var userKeyPublicKeyID int64 ··· 178 179 179 180 t.Run("DeleteOtherRepository", doAPIDeleteRepository(otherCtxWithDeleteRepo)) 180 181 181 - t.Run("RecreateRepository", doAPICreateRepository(ctxWithDeleteRepo, false)) 182 + t.Run("RecreateRepository", doAPICreateRepository(ctxWithDeleteRepo, false, git.Sha1ObjectFormat)) // FIXME: use forEachObjectFormat 182 183 183 184 t.Run("CreateUserKey", doAPICreateUserKey(ctx, keyname, keyFile, func(t *testing.T, publicKey api.PublicKey) { 184 185 userKeyPublicKeyID = publicKey.ID