mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-15 07:26:31 +03:00
49737cf009
(cherry picked from commit69741e4e66
) (cherry picked from commit2a3c7b09cb
) (cherry picked from commita1554c1168
) (cherry picked from commitedae2c6d2d
)
31 lines
787 B
Go
31 lines
787 B
Go
// SPDX-License-Identifier: MIT
|
|
|
|
package forgejo
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"code.gitea.io/gitea/models/db"
|
|
"code.gitea.io/gitea/models/unittest"
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestForgejo_PreMigrationSanityChecks(t *testing.T) {
|
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
|
ctx := db.DefaultContext
|
|
e := db.GetEngine(ctx)
|
|
|
|
assert.NoError(t, PreMigrationSanityChecks(e, ForgejoV4DatabaseVersion, configFixture(t, "")))
|
|
}
|
|
|
|
func configFixture(t *testing.T, content string) setting.ConfigProvider {
|
|
config := filepath.Join(t.TempDir(), "app.ini")
|
|
assert.NoError(t, os.WriteFile(config, []byte(content), 0o777))
|
|
cfg, err := setting.NewConfigProviderFromFile(config)
|
|
assert.NoError(t, err)
|
|
return cfg
|
|
}
|