mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Move some repository related code into sub package (#19711)
* Move some repository related code into sub package * Move more repository functions out of models * Fix lint * Some performance optimization for webhooks and others * some refactors * Fix lint * Fix * Update modules/repository/delete.go Co-authored-by: delvh <dev.lh@web.de> * Fix test * Merge * Fix test * Fix test * Fix test * Fix test Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
@@ -2,12 +2,13 @@
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package repo
|
||||
package repo_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
@@ -19,20 +20,20 @@ func TestPushMirrorsIterate(t *testing.T) {
|
||||
|
||||
now := timeutil.TimeStampNow()
|
||||
|
||||
InsertPushMirror(&PushMirror{
|
||||
repo_model.InsertPushMirror(&repo_model.PushMirror{
|
||||
RemoteName: "test-1",
|
||||
LastUpdateUnix: now,
|
||||
Interval: 1,
|
||||
})
|
||||
|
||||
long, _ := time.ParseDuration("24h")
|
||||
InsertPushMirror(&PushMirror{
|
||||
repo_model.InsertPushMirror(&repo_model.PushMirror{
|
||||
RemoteName: "test-2",
|
||||
LastUpdateUnix: now,
|
||||
Interval: long,
|
||||
})
|
||||
|
||||
InsertPushMirror(&PushMirror{
|
||||
repo_model.InsertPushMirror(&repo_model.PushMirror{
|
||||
RemoteName: "test-3",
|
||||
LastUpdateUnix: now,
|
||||
Interval: 0,
|
||||
@@ -40,8 +41,8 @@ func TestPushMirrorsIterate(t *testing.T) {
|
||||
|
||||
time.Sleep(1 * time.Millisecond)
|
||||
|
||||
PushMirrorsIterate(1, func(idx int, bean interface{}) error {
|
||||
m, ok := bean.(*PushMirror)
|
||||
repo_model.PushMirrorsIterate(1, func(idx int, bean interface{}) error {
|
||||
m, ok := bean.(*repo_model.PushMirror)
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, "test-1", m.RemoteName)
|
||||
assert.Equal(t, m.RemoteName, m.GetRemoteName())
|
||||
|
Reference in New Issue
Block a user