test: update RemoveNetworkMount_Commands for F1 rmdir step
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017CDMFpFx84pfviCTVuGGhf
This commit is contained in:
@@ -132,7 +132,11 @@ func TestValidateNetworkMountSpec(t *testing.T) {
|
||||
if err := ValidateNetworkMountSpec(base); err != nil {
|
||||
t.Errorf("valid NFS spec rejected: %v", err)
|
||||
}
|
||||
smb := good(func(s *NetworkMountSpec) { s.Protocol = ProtocolSMB; s.Export = "media"; s.CredsRef = "/var/lib/felhom-agent/smb-creds/media.cred" })
|
||||
smb := good(func(s *NetworkMountSpec) {
|
||||
s.Protocol = ProtocolSMB
|
||||
s.Export = "media"
|
||||
s.CredsRef = "/var/lib/felhom-agent/smb-creds/media.cred"
|
||||
})
|
||||
if err := ValidateNetworkMountSpec(smb); err != nil {
|
||||
t.Errorf("valid SMB spec rejected: %v", err)
|
||||
}
|
||||
@@ -312,8 +316,8 @@ func TestRemoveNetworkMount_Commands(t *testing.T) {
|
||||
if err := ops.RemoveNetworkMount(ctx, "media"); err != nil {
|
||||
t.Fatalf("RemoveNetworkMount: %v", err)
|
||||
}
|
||||
var stopAuto, disableAuto, rmCount, reload bool
|
||||
rms := 0
|
||||
var stopAuto, disableAuto, reload, rmdir bool
|
||||
rmUnits := 0
|
||||
for _, c := range rr.calls {
|
||||
j := strings.Join(c, " ")
|
||||
switch {
|
||||
@@ -321,14 +325,16 @@ func TestRemoveNetworkMount_Commands(t *testing.T) {
|
||||
stopAuto = true
|
||||
case strings.Contains(j, "disable") && strings.Contains(j, ".automount"):
|
||||
disableAuto = true
|
||||
case strings.Contains(j, "rm"):
|
||||
rms++
|
||||
case strings.Contains(j, "rmdir"): // F1: the mountpoint dir cleanup (must precede the rm -f check)
|
||||
rmdir = true
|
||||
case strings.Contains(j, "rm -f"):
|
||||
rmUnits++
|
||||
case strings.Contains(j, "daemon-reload"):
|
||||
reload = true
|
||||
}
|
||||
}
|
||||
rmCount = rms == 2
|
||||
if !stopAuto || !disableAuto || !rmCount || !reload {
|
||||
t.Fatalf("unexpected remove sequence (stopAuto=%v disableAuto=%v rm=%d reload=%v): %v", stopAuto, disableAuto, rms, reload, rr.calls)
|
||||
if !stopAuto || !disableAuto || rmUnits != 2 || !reload || !rmdir {
|
||||
t.Fatalf("unexpected remove sequence (stopAuto=%v disableAuto=%v rmUnits=%d reload=%v rmdir=%v): %v",
|
||||
stopAuto, disableAuto, rmUnits, reload, rmdir, rr.calls)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user