Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in gitea downloader test and add missing codebase in ToGitServiceType #33146

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions services/convert/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func ToGitServiceType(value string) structs.GitServiceType {
return structs.OneDevService
case "gitbucket":
return structs.GitBucketService
case "codebase":
return structs.CodebaseService
case "codecommit":
return structs.CodeCommitService
default:
Expand Down
10 changes: 9 additions & 1 deletion services/convert/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func TestToGitServiceType(t *testing.T) {
typ string
enum int
}{{
typ: "trash", enum: 1,
}, {
typ: "github", enum: 2,
}, {
typ: "gitea", enum: 3,
Expand All @@ -29,7 +31,13 @@ func TestToGitServiceType(t *testing.T) {
}, {
typ: "gogs", enum: 5,
}, {
typ: "trash", enum: 1,
typ: "onedev", enum: 6,
}, {
typ: "gitbucket", enum: 7,
}, {
typ: "codebase", enum: 8,
}, {
typ: "codecommit", enum: 9,
}}
for _, test := range tc {
assert.EqualValues(t, test.enum, ToGitServiceType(test.typ))
Expand Down
4 changes: 2 additions & 2 deletions services/migrations/gitea_downloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func TestGiteaDownloadRepo(t *testing.T) {

downloader, err := NewGiteaDownloader(context.Background(), "https://gitea.com", "gitea/test_repo", "", "", giteaToken)
if downloader == nil {
t.Fatal("NewGitlabDownloader is nil")
t.Fatal("NewGiteaDownloader is nil")
}
if !assert.NoError(t, err) {
t.Fatal("NewGitlabDownloader error occur")
t.Fatal("NewGiteaDownloader error occur")
}

repo, err := downloader.GetRepoInfo()
Expand Down
Loading