update unit test

This commit is contained in:
MaysWind
2023-08-14 22:47:54 +08:00
parent 86e9a3e838
commit 94283a8da2
+6 -6
View File
@@ -138,7 +138,7 @@ func TestGenerateUuid_10000TimesConcurrent(t *testing.T) {
}
func TestGenerateUuid_1000000TimesConcurrent(t *testing.T) {
concurrentCount := 50
concurrentCount := 10
generator, _ := NewInternalUuidGenerator(&settings.Config{UuidServerId: 3})
var mutex sync.Mutex
var generatedIds sync.Map
@@ -148,8 +148,8 @@ func TestGenerateUuid_1000000TimesConcurrent(t *testing.T) {
go func(currentRoutineIndex int) {
waitGroup.Add(1)
for cycle := 0; cycle < 40000; cycle++ {
if cycle%10000 == 0 { // each server can only generate 500,000 (50 * 10000) uuids in one second
for cycle := 0; cycle < 100000; cycle++ {
if cycle%50000 == 0 { // each server can only generate 500,000 (10 * 50000) uuids in one second
time.Sleep(1000 * time.Millisecond)
}
@@ -315,8 +315,8 @@ func TestGenerateUuids_20000TimesConcurrent(t *testing.T) {
}
func TestGenerateUuids_1000000TimesConcurrent(t *testing.T) {
concurrentCount := 50
expectedUuidCount := uint8(100)
concurrentCount := 10
expectedUuidCount := uint8(250)
generator, _ := NewInternalUuidGenerator(&settings.Config{UuidServerId: 3})
var mutex sync.Mutex
var generatedIds sync.Map
@@ -327,7 +327,7 @@ func TestGenerateUuids_1000000TimesConcurrent(t *testing.T) {
waitGroup.Add(1)
for cycle := 0; cycle < 400; cycle++ {
if cycle%100 == 0 { // each server can only generate 500,000 (50 * 10000) uuids in one second
if cycle%200 == 0 { // each server can only generate 500,000 (10 * 250 * 200) uuids in one second
time.Sleep(1000 * time.Millisecond)
}