Skip to content

Commit

Permalink
Test AsLocklessMigrator
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Jun 30, 2022
1 parent 8e4dd43 commit d757836
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dbump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,28 @@ func TestMigrateDrop(t *testing.T) {
mustEqual(t, mm.log, wantLog)
}

func TestLockless(t *testing.T) {
wantLog := []string{
"init",
"getversion",
"dostep", "{v:1 q:'SELECT 1;' notx:false}",
"dostep", "{v:2 q:'SELECT 2;' notx:false}",
"dostep", "{v:3 q:'SELECT 3;' notx:false}",
"dostep", "{v:4 q:'SELECT 4;' notx:false}",
"dostep", "{v:5 q:'SELECT 5;' notx:false}",
}

mm := &MockMigrator{}
cfg := Config{
Migrator: AsLocklessMigrator(mm),
Loader: NewSliceLoader(testdataMigrations),
Mode: ModeUp,
}

failIfErr(t, Run(context.Background(), cfg))
mustEqual(t, mm.log, wantLog)
}

func TestUseForce(t *testing.T) {
currVersion := 3
wantLog := []string{
Expand Down

0 comments on commit d757836

Please sign in to comment.