aboutsummaryrefslogtreecommitdiffstats
path: root/services/release
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-01 21:40:17 +0800
committerGitHub <noreply@github.com>2019-10-01 21:40:17 +0800
commit7ff783b7320bdeda89ed6a021c304e64f9d9170e (patch)
treeaba54e41a83ec4064f0d5d09024e94c4ce4030d1 /services/release
parent177aedfca9bf4a15dd154a1f1ac136e9ba3e0f24 (diff)
downloadgitea-7ff783b7320bdeda89ed6a021c304e64f9d9170e.tar.gz
gitea-7ff783b7320bdeda89ed6a021c304e64f9d9170e.zip
Move mirror to a standalone package from models (#7486)
* move mirror to a standalone package * fix mirror address in template * fix tests * fix lint * fix comment * fix tests * fix tests * fix vendor * fix fmt * fix lint * remove wrong file submitted * fix conflict * remove unrelated changes * fix go mod * fix tests * clean go mod * make vendor work * make vendor work * fix tests * remove duplicated test
Diffstat (limited to 'services/release')
-rw-r--r--services/release/release_test.go59
1 files changed, 0 insertions, 59 deletions
diff --git a/services/release/release_test.go b/services/release/release_test.go
index 97febeecb9..d30dfee286 100644
--- a/services/release/release_test.go
+++ b/services/release/release_test.go
@@ -100,62 +100,3 @@ func TestRelease_Create(t *testing.T) {
IsTag: true,
}, nil))
}
-
-func TestRelease_MirrorDelete(t *testing.T) {
- assert.NoError(t, models.PrepareTestDatabase())
-
- user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
- repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
- repoPath := models.RepoPath(user.Name, repo.Name)
- migrationOptions := models.MigrateRepoOptions{
- Name: "test_mirror",
- Description: "Test mirror",
- IsPrivate: false,
- IsMirror: true,
- RemoteAddr: repoPath,
- Wiki: true,
- SyncReleasesWithTags: true,
- }
- mirror, err := models.MigrateRepository(user, user, migrationOptions)
- assert.NoError(t, err)
-
- gitRepo, err := git.OpenRepository(repoPath)
- assert.NoError(t, err)
-
- findOptions := models.FindReleasesOptions{IncludeDrafts: true, IncludeTags: true}
- initCount, err := models.GetReleaseCountByRepoID(mirror.ID, findOptions)
- assert.NoError(t, err)
-
- assert.NoError(t, CreateRelease(gitRepo, &models.Release{
- RepoID: repo.ID,
- PublisherID: user.ID,
- TagName: "v0.2",
- Target: "master",
- Title: "v0.2 is released",
- Note: "v0.2 is released",
- IsDraft: false,
- IsPrerelease: false,
- IsTag: true,
- }, nil))
-
- err = mirror.GetMirror()
- assert.NoError(t, err)
-
- ok := models.RunMirrorSync(mirror.Mirror)
- assert.True(t, ok)
-
- count, err := models.GetReleaseCountByRepoID(mirror.ID, findOptions)
- assert.NoError(t, err)
- assert.EqualValues(t, initCount+1, count)
-
- release, err := models.GetRelease(repo.ID, "v0.2")
- assert.NoError(t, err)
- assert.NoError(t, DeleteReleaseByID(release.ID, user, true))
-
- ok = models.RunMirrorSync(mirror.Mirror)
- assert.True(t, ok)
-
- count, err = models.GetReleaseCountByRepoID(mirror.ID, findOptions)
- assert.NoError(t, err)
- assert.EqualValues(t, initCount, count)
-}