aboutsummaryrefslogtreecommitdiffstats
path: root/models/index_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-06-14 10:22:55 +0800
committerGitHub <noreply@github.com>2021-06-14 10:22:55 +0800
commit0393a57511dc863bea4783fbb4b57cd11c41688a (patch)
treef479085c97ffe419e6fe02c88f6a2730a673fcb8 /models/index_test.go
parenta005265718b840d34858a3b705f8133e1b4dbdbf (diff)
downloadgitea-0393a57511dc863bea4783fbb4b57cd11c41688a.tar.gz
gitea-0393a57511dc863bea4783fbb4b57cd11c41688a.zip
Add a new table issue_index to store the max issue index so that issue could be deleted with no duplicated index (#15599)
* Add a new table issue_index to store the max issue index so that issue could be deleted with no duplicated index * Fix pull index * Add tests for concurrent creating issues * Fix lint * Fix tests * Fix postgres test * Add test for migration v180 * Rename wrong test file name Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'models/index_test.go')
-rw-r--r--models/index_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/models/index_test.go b/models/index_test.go
new file mode 100644
index 0000000000..40e570ad9f
--- /dev/null
+++ b/models/index_test.go
@@ -0,0 +1,27 @@
+// Copyright 2021 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package models
+
+import (
+ "fmt"
+ "sync"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestResourceIndex(t *testing.T) {
+ assert.NoError(t, PrepareTestDatabase())
+
+ var wg sync.WaitGroup
+ for i := 0; i < 100; i++ {
+ wg.Add(1)
+ go func(i int) {
+ testInsertIssue(t, fmt.Sprintf("issue %d", i+1), "my issue", 0)
+ wg.Done()
+ }(i)
+ }
+ wg.Wait()
+}