MCPcopy Create free account
hub / github.com/gogs/gogs / TestDumpAndImport

Function TestDumpAndImport

internal/database/backup_test.go:24–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestDumpAndImport(t *testing.T) {
25 if testing.Short() {
26 t.Skip()
27 }
28 t.Parallel()
29
30 const wantTables = 8
31 if len(Tables) != wantTables {
32 t.Fatalf("New table has added (want %d got %d), please add new tests for the table and update this check", wantTables, len(Tables))
33 }
34
35 db := dbtest.NewDB(t, "dumpAndImport", Tables...)
36 setupDBToDump(t, db)
37 dumpTables(t, db)
38 importTables(t, db)
39
40 // Dump and assert golden again to make sure data aren't changed.
41 dumpTables(t, db)
42}
43
44func setupDBToDump(t *testing.T, db *gorm.DB) {
45 vals := []any{

Callers

nothing calls this directly

Calls 4

NewDBFunction · 0.92
setupDBToDumpFunction · 0.85
dumpTablesFunction · 0.85
importTablesFunction · 0.85

Tested by

no test coverage detected