1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-01 17:38:33 +00:00

Add testifylint to lint checks (#4535)

go-require lint is ignored for now

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4535
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
TheFox0x7 2024-07-30 19:41:10 +00:00 committed by Earl Warren
parent 94933470cd
commit 4de909747b
504 changed files with 5028 additions and 4680 deletions

View file

@ -25,6 +25,7 @@ import (
"code.gitea.io/gitea/services/migrations"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)
@ -40,12 +41,12 @@ func TestDumpRestore(t *testing.T) {
setting.AppVer = AppVer
}()
assert.NoError(t, migrations.Init())
require.NoError(t, migrations.Init())
reponame := "repo1"
basePath, err := os.MkdirTemp("", reponame)
assert.NoError(t, err)
require.NoError(t, err)
defer util.RemoveAll(basePath)
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: reponame})
@ -70,7 +71,7 @@ func TestDumpRestore(t *testing.T) {
RepoName: reponame,
}
err = migrations.DumpRepository(ctx, basePath, repoOwner.Name, opts)
assert.NoError(t, err)
require.NoError(t, err)
//
// Verify desired side effects of the dump
@ -88,7 +89,7 @@ func TestDumpRestore(t *testing.T) {
err = migrations.RestoreRepository(ctx, d, repo.OwnerName, newreponame, []string{
"labels", "issues", "comments", "milestones", "pull_requests",
}, false)
assert.NoError(t, err)
require.NoError(t, err)
newrepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: newreponame})
@ -98,7 +99,7 @@ func TestDumpRestore(t *testing.T) {
opts.RepoName = newreponame
opts.CloneAddr = newrepo.CloneLink().HTTPS
err = migrations.DumpRepository(ctx, basePath, repoOwner.Name, opts)
assert.NoError(t, err)
require.NoError(t, err)
//
// Verify the dump of restored is the same as the dump of repo1
@ -224,11 +225,11 @@ func (c *compareDump) assertLoadYAMLFiles(beforeFilename, afterFilename string,
}
beforeBytes, err := os.ReadFile(beforeFilename)
assert.NoError(c.t, err)
assert.NoError(c.t, yaml.Unmarshal(beforeBytes, before))
require.NoError(c.t, err)
require.NoError(c.t, yaml.Unmarshal(beforeBytes, before))
afterBytes, err := os.ReadFile(afterFilename)
assert.NoError(c.t, err)
assert.NoError(c.t, yaml.Unmarshal(afterBytes, after))
require.NoError(c.t, err)
require.NoError(c.t, yaml.Unmarshal(afterBytes, after))
}
func (c *compareDump) assertLoadFiles(beforeFilename, afterFilename string, t reflect.Type) (before, after reflect.Value) {