From 3089480c3074413122ea5f5c0f5d9795c77dbd71 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 2 Jul 2026 18:01:57 -0700 Subject: [PATCH] fix(fuse-tests): pass glog flags before the mount subcommand (#10215) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glog flags (-v, -logtostderr) are registered on weed's global flagset, so passing them after the subcommand name kills the process at flag parsing: flag provided but not defined: -logtostderr. The old stat-based mount readiness probe masked this — TestWriteBufferCap silently ran against the bare local directory and passed. The device-ID readiness check now surfaces the dead mount as a not-ready timeout. Move glog flags into MountGlobalOptions, emitted before the subcommand, and do the same for the EnableDebug verbosity flag on mini and mount. --- test/fuse_integration/framework_test.go | 56 ++++++++++--------- .../fuse_integration/write_buffer_cap_test.go | 16 +++--- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/test/fuse_integration/framework_test.go b/test/fuse_integration/framework_test.go index 83aa1e75c..9fc3e28e6 100644 --- a/test/fuse_integration/framework_test.go +++ b/test/fuse_integration/framework_test.go @@ -34,14 +34,18 @@ type FuseTestFramework struct { // TestConfig holds configuration for FUSE tests type TestConfig struct { - Collection string - Replication string - ChunkSizeMB int - CacheSizeMB int - NumVolumes int - EnableDebug bool - MountOptions []string - SkipCleanup bool // for debugging failed tests + Collection string + Replication string + ChunkSizeMB int + CacheSizeMB int + NumVolumes int + EnableDebug bool + // MountGlobalOptions are glog flags (-v, -logtostderr, ...) registered on + // weed's global flagset; they must precede the subcommand name or the + // mount process dies at flag parsing. + MountGlobalOptions []string + MountOptions []string + SkipCleanup bool // for debugging failed tests } // DefaultTestConfig returns a default configuration for FUSE tests @@ -246,19 +250,20 @@ func (f *FuseTestFramework) copyLogsForCI() { // startMini starts "weed mini" which runs master+volume+filer in one process. func (f *FuseTestFramework) startMini(config *TestConfig) error { - args := []string{ - "mini", - "-dir=" + f.dataDir, - "-ip=127.0.0.1", - "-ip.bind=127.0.0.1", - "-filer.port=" + strconv.Itoa(f.filerPort), - "-s3=false", - "-webdav=false", - "-admin.ui=false", - } + var args []string if config.EnableDebug { args = append(args, "-v=4") } + args = append(args, + "mini", + "-dir="+f.dataDir, + "-ip=127.0.0.1", + "-ip.bind=127.0.0.1", + "-filer.port="+strconv.Itoa(f.filerPort), + "-s3=false", + "-webdav=false", + "-admin.ui=false", + ) proc, err := f.startProcess("mini", args) if err != nil { @@ -270,14 +275,18 @@ func (f *FuseTestFramework) startMini(config *TestConfig) error { // mountFuse mounts the SeaweedFS FUSE filesystem func (f *FuseTestFramework) mountFuse(config *TestConfig) error { - args := []string{ + args := append([]string{}, config.MountGlobalOptions...) + if config.EnableDebug { + args = append(args, "-v=4") + } + args = append(args, "mount", - "-filer=127.0.0.1:" + strconv.Itoa(f.filerPort), - "-dir=" + f.mountPoint, + "-filer=127.0.0.1:"+strconv.Itoa(f.filerPort), + "-dir="+f.mountPoint, "-filer.path=/", "-dirAutoCreate", "-allowOthers=false", - } + ) if config.Collection != "" { args = append(args, "-collection="+config.Collection) @@ -291,9 +300,6 @@ func (f *FuseTestFramework) mountFuse(config *TestConfig) error { if config.CacheSizeMB > 0 { args = append(args, fmt.Sprintf("-cacheCapacityMB=%d", config.CacheSizeMB)) } - if config.EnableDebug { - args = append(args, "-v=4") - } args = append(args, config.MountOptions...) diff --git a/test/fuse_integration/write_buffer_cap_test.go b/test/fuse_integration/write_buffer_cap_test.go index 0f7320db2..3f87af60e 100644 --- a/test/fuse_integration/write_buffer_cap_test.go +++ b/test/fuse_integration/write_buffer_cap_test.go @@ -79,6 +79,15 @@ func writeBufferCapConfig(debugPort int) *TestConfig { CacheSizeMB: 100, // read cache (unrelated) NumVolumes: 3, EnableDebug: false, + // Route glog to stderr so the framework's process log capture + // actually contains something — by default weed sends glog to + // /tmp/weed.* files which the CI artifact upload step never + // sees. Critical for diagnosing upload/saveToStorage errors + // on Linux runs. + MountGlobalOptions: []string{ + "-logtostderr=true", + "-v=2", + }, MountOptions: []string{ // 16 MiB total write buffer ⇒ up to 8 chunks in flight // across every open file handle on this mount. Large @@ -88,13 +97,6 @@ func writeBufferCapConfig(debugPort int) *TestConfig { "-writeBufferSizeMB=16", "-debug=true", fmt.Sprintf("-debug.port=%d", debugPort), - // Route glog to stderr so the framework's process log - // capture actually contains something — by default weed - // sends glog to /tmp/weed.* files which the CI artifact - // upload step never sees. Critical for diagnosing - // upload/saveToStorage errors on Linux runs. - "-logtostderr=true", - "-v=2", }, SkipCleanup: false, }