feat: update gitea vendor
runner nix smoke / nix label and flake smoke (push) Failing after 1m28s

This commit is contained in:
2026-09-26 21:18:24 +00:00
parent c439c1b948
commit d9b2a4e787
3538 changed files with 116131 additions and 44340 deletions
@@ -4,32 +4,30 @@
package migrations
import (
"net/http"
"os"
"path/filepath"
"runtime"
"sort"
"testing"
"time"
base "code.gitea.io/gitea/modules/migration"
"gitea.dev/models/unittest"
base "gitea.dev/modules/migration"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGiteaDownloadRepo(t *testing.T) {
// Skip tests if Gitea token is not found (TODO: this test seems stopped for long time because there is no token in CI secrets)
giteaToken := os.Getenv("GITEA_TEST_OFFICIAL_SITE_TOKEN")
if giteaToken == "" {
t.Skip("skipped test because GITEA_TEST_OFFICIAL_SITE_TOKEN was not in the environment")
}
token := os.Getenv("GITEA_TEST_OFFICIAL_SITE_TOKEN")
liveMode := token != ""
_, callerFile, _, _ := runtime.Caller(0)
fixtureDir := filepath.Join(filepath.Dir(callerFile), "_mock_data/TestGiteaDownloadRepo")
mockServer := unittest.NewMockWebServer(t, "https://gitea.com", fixtureDir, liveMode)
resp, err := http.Get("https://gitea.com/gitea")
if err != nil || resp.StatusCode != http.StatusOK {
t.Skipf("Can't reach https://gitea.com, skipping %s", t.Name())
}
defer resp.Body.Close()
ctx := t.Context()
downloader, err := NewGiteaDownloader(ctx, "https://gitea.com", "gitea/test_repo", "", "", giteaToken)
downloader, err := NewGiteaDownloader(ctx, mockServer.URL, "gitea/test_repo", "", "", token)
require.NoError(t, err, "NewGiteaDownloader error occur")
require.NotNil(t, downloader, "NewGiteaDownloader is nil")
@@ -40,8 +38,9 @@ func TestGiteaDownloadRepo(t *testing.T) {
Owner: "gitea",
IsPrivate: false,
Description: "Test repository for testing migration from gitea to gitea",
CloneURL: "https://gitea.com/gitea/test_repo.git",
OriginalURL: "https://gitea.com/gitea/test_repo",
Website: mockServer.URL + "/test-repo",
CloneURL: mockServer.URL + "/gitea/test_repo.git",
OriginalURL: mockServer.URL + "/gitea/test_repo",
DefaultBranch: "master",
}, repo)
@@ -83,21 +82,21 @@ func TestGiteaDownloadRepo(t *testing.T) {
milestones, err := downloader.GetMilestones(ctx)
assert.NoError(t, err)
assertMilestonesEqual(t, []*base.Milestone{
{
Title: "V2 Finalize",
Created: time.Unix(0, 0),
Deadline: new(time.Unix(1599263999, 0)),
Updated: new(time.Unix(0, 0)),
State: "open",
},
{
Title: "V1",
Description: "Generate Content",
Created: time.Unix(0, 0),
Updated: new(time.Unix(0, 0)),
Closed: new(time.Unix(1598985406, 0)),
Closed: new(time.Date(2020, 9, 1, 18, 36, 46, 0, time.UTC)),
State: "closed",
},
{
Title: "V2 Finalize",
Created: time.Unix(0, 0),
Deadline: new(time.Date(2020, 9, 4, 23, 59, 59, 0, time.UTC)),
Updated: new(time.Date(2022, 11, 13, 5, 29, 15, 0, time.UTC)),
State: "open",
},
}, milestones)
releases, err := downloader.GetReleases(ctx)
@@ -114,7 +113,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
Published: time.Date(2020, 9, 1, 18, 2, 43, 0, time.UTC),
PublisherID: 689,
PublisherName: "6543",
PublisherEmail: "6543@obermui.de",
PublisherEmail: "689+6543@noreply.gitea.com",
},
{
Name: "First Release",
@@ -127,7 +126,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
Published: time.Date(2020, 9, 1, 17, 30, 32, 0, time.UTC),
PublisherID: 689,
PublisherName: "6543",
PublisherEmail: "6543@obermui.de",
PublisherEmail: "689+6543@noreply.gitea.com",
},
}, releases)
@@ -149,7 +148,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
Milestone: "V1",
PosterID: -1,
PosterName: "Ghost",
PosterEmail: "",
PosterEmail: "-1+ghost@noreply.gitea.com",
State: "closed",
IsLocked: true,
Created: time.Unix(1598975321, 0),
@@ -180,7 +179,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
Milestone: "",
PosterID: 689,
PosterName: "6543",
PosterEmail: "6543@obermui.de",
PosterEmail: "689+6543@noreply.gitea.com",
State: "closed",
IsLocked: false,
Created: time.Unix(1598919780, 0),
@@ -201,7 +200,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
IssueIndex: 4,
PosterID: 689,
PosterName: "6543",
PosterEmail: "6543@obermui.de",
PosterEmail: "689+6543@noreply.gitea.com",
Created: time.Unix(1598975370, 0),
Updated: time.Unix(1599070865, 0),
Content: "a really good question!\n\nIt is the used as TESTSET for gitea2gitea repo migration function",
@@ -210,7 +209,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
IssueIndex: 4,
PosterID: -1,
PosterName: "Ghost",
PosterEmail: "",
PosterEmail: "-1+ghost@noreply.gitea.com",
Created: time.Unix(1598975393, 0),
Updated: time.Unix(1598975393, 0),
Content: "Oh!",
@@ -229,7 +228,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
Number: 12,
PosterID: 689,
PosterName: "6543",
PosterEmail: "6543@obermui.de",
PosterEmail: "689+6543@noreply.gitea.com",
Title: "Dont Touch",
Content: "\r\nadd dont touch note",
Milestone: "V2 Finalize",
@@ -237,7 +236,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
IsLocked: false,
Created: time.Unix(1598982759, 0),
Updated: time.Unix(1599023425, 0),
Closed: new(time.Unix(1598982934, 0)),
Closed: new(time.Unix(1598982933, 0)),
Assignees: []string{"techknowlogick"},
Base: base.PullRequestBranch{
CloneURL: "",
@@ -247,7 +246,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
OwnerName: "gitea",
},
Head: base.PullRequestBranch{
CloneURL: "https://gitea.com/6543-forks/test_repo.git",
CloneURL: mockServer.URL + "/6543-forks/test_repo.git",
Ref: "refs/pull/12/head",
SHA: "b6ab5d9ae000b579a5fff03f92c486da4ddf48b6",
RepoName: "test_repo",
@@ -256,7 +255,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
Merged: true,
MergedTime: new(time.Unix(1598982934, 0)),
MergeCommitSHA: "827aa28a907853e5ddfa40c8f9bc52471a2685fd",
PatchURL: "https://gitea.com/gitea/test_repo/pulls/12.patch",
PatchURL: mockServer.URL + "/gitea/test_repo/pulls/12.patch",
}, prs[1])
reviews, err := downloader.GetReviews(ctx, &base.Issue{Number: 7, ForeignIndex: 7})
@@ -283,7 +282,7 @@ func TestGiteaDownloadRepo(t *testing.T) {
PosterID: 689,
Reactions: nil,
CreatedAt: time.Date(2020, 9, 1, 16, 12, 58, 0, time.UTC),
UpdatedAt: time.Date(2020, 9, 1, 16, 12, 58, 0, time.UTC),
UpdatedAt: time.Date(2024, 6, 3, 1, 18, 36, 0, time.UTC),
},
},
},