ensure consistent testing

This commit is contained in:
chrislu
2025-06-16 10:56:37 -07:00
parent f598d8e84c
commit f0e987dc9d
2 changed files with 21 additions and 6 deletions

View File

@@ -1,10 +1,11 @@
package lock_manager
import (
"github.com/seaweedfs/seaweedfs/weed/pb"
"github.com/stretchr/testify/assert"
"testing"
"time"
"github.com/seaweedfs/seaweedfs/weed/pb"
"github.com/stretchr/testify/assert"
)
func TestAddServer(t *testing.T) {
@@ -21,7 +22,9 @@ func TestAddServer(t *testing.T) {
assert.Equal(t, 8, len(r.snapshots))
time.Sleep(110 * time.Millisecond)
// Wait for all cleanup operations to complete instead of using time.Sleep
time.Sleep(110 * time.Millisecond) // Still need to wait for the cleanup interval
r.WaitForCleanup() // Ensure all cleanup goroutines have finished
assert.Equal(t, 2, len(r.snapshots))