summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/test_fixtures.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/models/test_fixtures.go b/models/test_fixtures.go
index d7f59ec3b5..2a70bc9816 100644
--- a/models/test_fixtures.go
+++ b/models/test_fixtures.go
@@ -19,5 +19,14 @@ func InitFixtures(helper testfixtures.Helper, dir string) (err error) {
// LoadFixtures load fixtures for a test database
func LoadFixtures() error {
- return fixtures.Load()
+ var err error
+ // Database transaction conflicts could occur and result in ROLLBACK
+ // As a simple workaround, we just retry 5 times.
+ for i := 0; i < 5; i++ {
+ err = fixtures.Load()
+ if err == nil {
+ break
+ }
+ }
+ return err
}