Skip to content

Commit

Permalink
Merge branch 'v3' into juju-7322/improve-usability-of-migrate-command
Browse files Browse the repository at this point in the history
  • Loading branch information
ale8k authored Dec 17, 2024
2 parents 674926c + 6fa9787 commit d124ac8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/dbmodel/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,25 @@ func TestGroupEntry(t *testing.T) {
c.Assert(result.Error, qt.IsNil)
c.Assert(ge3, qt.DeepEquals, ge)
}

// TestHardDeleteGroupEntry tests hard delete of groups, to make sure we can create a group with the same name after deleting it.
func TestHardDeleteGroupEntry(t *testing.T) {
c := qt.New(t)
db := gormDB(t)

ge := dbmodel.GroupEntry{
Name: "test-group-1",
}
c.Assert(db.Create(&ge).Error, qt.IsNil)
c.Assert(ge.ID, qt.Equals, uint(1))

c.Assert(db.Delete(ge).Error, qt.IsNil)

result := db.First(&ge)
c.Assert(result.Error, qt.ErrorMatches, "record not found")

ge1 := dbmodel.GroupEntry{
Name: "test-group-1",
}
c.Assert(db.Create(&ge1).Error, qt.IsNil)
}

0 comments on commit d124ac8

Please sign in to comment.