aboutsummaryrefslogtreecommitdiff
path: root/internal/db/backup_test.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-06-25 18:07:39 +0800
committerGitHub <noreply@github.com>2022-06-25 18:07:39 +0800
commit083c3ee659c6c5542687f3bafae68cbc24dbc90f (patch)
tree0103bf3b5c5ebfccd368a7cb6a425a521fd669d9 /internal/db/backup_test.go
parent9df4e3ae3c555a86f691f0d78a43834842e77d8b (diff)
db: refactor "action" table to use GORM (#7054)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/db/backup_test.go')
-rw-r--r--internal/db/backup_test.go47
1 files changed, 44 insertions, 3 deletions
diff --git a/internal/db/backup_test.go b/internal/db/backup_test.go
index 1221dac3..b79d455c 100644
--- a/internal/db/backup_test.go
+++ b/internal/db/backup_test.go
@@ -29,11 +29,10 @@ func TestDumpAndImport(t *testing.T) {
if testing.Short() {
t.Skip()
}
-
t.Parallel()
- if len(Tables) != 4 {
- t.Fatalf("New table has added (want 4 got %d), please add new tests for the table and update this check", len(Tables))
+ if len(Tables) != 5 {
+ t.Fatalf("New table has added (want 5 got %d), please add new tests for the table and update this check", len(Tables))
}
db := dbtest.NewDB(t, "dumpAndImport", Tables...)
@@ -90,6 +89,48 @@ func setupDBToDump(t *testing.T, db *gorm.DB) {
CreatedUnix: 1588568886,
},
+ &Action{
+ ID: 1,
+ UserID: 1,
+ OpType: ActionCreateBranch,
+ ActUserID: 1,
+ ActUserName: "alice",
+ RepoID: 1,
+ RepoUserName: "alice",
+ RepoName: "example",
+ RefName: "main",
+ IsPrivate: false,
+ Content: `{"Len":1,"Commits":[],"CompareURL":""}`,
+ CreatedUnix: 1588568886,
+ },
+ &Action{
+ ID: 2,
+ UserID: 1,
+ OpType: ActionCommitRepo,
+ ActUserID: 1,
+ ActUserName: "alice",
+ RepoID: 1,
+ RepoUserName: "alice",
+ RepoName: "example",
+ RefName: "main",
+ IsPrivate: false,
+ Content: `{"Len":1,"Commits":[],"CompareURL":""}`,
+ CreatedUnix: 1588568886,
+ },
+ &Action{
+ ID: 3,
+ UserID: 1,
+ OpType: ActionDeleteBranch,
+ ActUserID: 1,
+ ActUserName: "alice",
+ RepoID: 1,
+ RepoUserName: "alice",
+ RepoName: "example",
+ RefName: "main",
+ IsPrivate: false,
+ CreatedUnix: 1588568886,
+ },
+
&LFSObject{
RepoID: 1,
OID: "ef797c8118f02dfb649607dd5d3f8c7623048c9c063d532cc95c5ed7a898a64f",