Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix `vid_map_test` tests

LHHDZ994a2dec78bc
diff --git a/weed/wdclient/vid_map_test.go b/weed/wdclient/vid_map_test.go
index 76746e948d..b1cd24490a 100644
--- a/weed/wdclient/vid_map_test.go
+++ b/weed/wdclient/vid_map_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"google.golang.org/grpc"
"strconv"
+ "sync"
"testing"
)
@@ -112,18 +113,23 @@ func TestLookupFileId(t *testing.T) {
}
//lock: concurrent test
- go func() {
- for i := 0; i < 100; i++ {
- mc.addLocation(uint32(i), Location{})
- }
- }()
- for i := 0; i < 10; i++ {
- for i := 0; i < 100; i++ {
- for i := 0; i < 20; i++ {
- _, _ = mc.GetLocations(uint32(i))
+ var wg sync.WaitGroup
+ for i := 0; i < 20; i++ {
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ for i := 0; i < 100; i++ {
+ for i := 0; i < 20; i++ {
+ _, _ = mc.GetLocations(uint32(i))
+ }
}
- }
+ }()
+ }
+
+ for i := 0; i < 100; i++ {
+ mc.addLocation(uint32(i), Location{})
}
+ wg.Wait()
}
func BenchmarkLocationIndex(b *testing.B) {