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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
test(s3 remote cache): wait for the master to list the filer before shell commands (#12018)
Chris Lu81e0859c122c
diff --git a/test/s3/remote_cache/remote_cache_evict_test.go b/test/s3/remote_cache/remote_cache_evict_test.goindex cb44f1f3fb..8fab9c53b9 100644--- a/test/s3/remote_cache/remote_cache_evict_test.go+++ b/test/s3/remote_cache/remote_cache_evict_test.go@@ -99,6 +99,27 @@ func shellOn(t *testing.T, masterPort, command string) string {return stripLogs(string(out))}+// waitForFilerListed polls the master until it lists a filer. A fresh+// single-filer mini registers its filer only after an ~10 s empty-membership+// confirm, and weed shell finds the filer through that listing, so shell+// commands sent before it fail.+func waitForFilerListed(t *testing.T, masterPort string) {+ t.Helper()+ deadline := time.Now().Add(60 * time.Second)+ for {+ cmd := exec.Command(weedBinary, "shell", "-master=localhost:"+masterPort)+ cmd.Stdin = strings.NewReader("cluster.ps\nexit\n")+ out, err := cmd.CombinedOutput()+ if err == nil && strings.Contains(string(out), "* filers ") && !strings.Contains(string(out), "* filers 0\n") {+ return+ }+ if time.Now().After(deadline) {+ t.Fatalf("master on %s lists no filer after 60s: %v\n%s", masterPort, err, out)+ }+ time.Sleep(time.Second)+ }+}+func chunkCountOn(t *testing.T, masterPort, path string) string {meta := shellOn(t, masterPort, "fs.meta.cat "+path)idx := strings.LastIndex(meta, "chunks ")@@ -166,6 +187,7 @@ func TestRemoteCacheEvictUnderPressure(t *testing.T) {"-master.volumeSizeLimitMB=32", "-volume.max=2","-filer.remoteCacheEvictThreshold=0.99")waitForHTTP(t, evictPrimaryS3)+ waitForFilerListed(t, evictPrimaryMaster)remote := createS3Client(evictRemoteS3)_, err := remote.CreateBucket(&s3.CreateBucketInput{Bucket: aws.String(evictBucket)})