(t *testing.T)
| 479 | } |
| 480 | |
| 481 | func TestTransactionWithDefaultTimeout(t *testing.T) { |
| 482 | db, err := OpenTestConnection(&gorm.Config{DefaultTransactionTimeout: 2 * time.Second}) |
| 483 | if err != nil { |
| 484 | t.Fatalf("failed to connect database, got error %v", err) |
| 485 | } |
| 486 | |
| 487 | tx := db.Begin() |
| 488 | time.Sleep(3 * time.Second) |
| 489 | if err = tx.Find(&User{}).Error; err == nil { |
| 490 | t.Errorf("should return error when transaction timeout, got error %v", err) |
| 491 | } |
| 492 | } |
nothing calls this directly
no test coverage detected