Fix tests broken by preauthkey tags

This commit is contained in:
Benjamin George Roberts 2022-08-25 20:12:41 +10:00
parent 791272e408
commit 6faa1d2e4a
8 changed files with 45 additions and 33 deletions

View file

@ -129,7 +129,7 @@ func (h *Headscale) GetPreAuthKey(namespace string, key string) (*PreAuthKey, er
// does not exist.
func (h *Headscale) DestroyPreAuthKey(pak PreAuthKey) error {
return h.db.Transaction(func(db *gorm.DB) error {
if result := db.Unscoped().Delete(PreAuthKeyAclTag{PreAuthKeyID: pak.ID}); result.Error != nil {
if result := db.Unscoped().Where(PreAuthKeyAclTag{PreAuthKeyID: pak.ID}).Delete(&PreAuthKeyAclTag{}); result.Error != nil {
return result.Error
}