container/initproc: check path equivalence by value
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m10s
Test / Hakurei (push) Successful in 3m10s
Test / Hpkg (push) Successful in 4m8s
Test / Sandbox (race detector) (push) Successful in 4m26s
Test / Hakurei (race detector) (push) Successful in 4m58s
Test / Flake checks (push) Successful in 1m19s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m10s
Test / Hakurei (push) Successful in 3m10s
Test / Hpkg (push) Successful in 4m8s
Test / Sandbox (race detector) (push) Successful in 4m26s
Test / Hakurei (race detector) (push) Successful in 4m58s
Test / Flake checks (push) Successful in 1m19s
Fixes regression introduced while integrating Absolute. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
d65e5f817a
commit
c6397b941f
@ -35,7 +35,8 @@ func (p *MountProcOp) apply(state *setupState) error {
|
|||||||
|
|
||||||
func (p *MountProcOp) Is(op Op) bool {
|
func (p *MountProcOp) Is(op Op) bool {
|
||||||
vp, ok := op.(*MountProcOp)
|
vp, ok := op.(*MountProcOp)
|
||||||
return ok && ((p == nil && vp == nil) || p == vp)
|
return ok && ((p == nil && vp == nil) ||
|
||||||
|
(p.Target != nil && vp.Target != nil && p.Target.Is(vp.Target)))
|
||||||
}
|
}
|
||||||
func (*MountProcOp) prefix() string { return "mounting" }
|
func (*MountProcOp) prefix() string { return "mounting" }
|
||||||
func (p *MountProcOp) String() string { return fmt.Sprintf("proc on %q", p.Target) }
|
func (p *MountProcOp) String() string { return fmt.Sprintf("proc on %q", p.Target) }
|
||||||
|
32
container/initproc_test.go
Normal file
32
container/initproc_test.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package container
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestMountProcOp(t *testing.T) {
|
||||||
|
checkOpsBuilder(t, []opsBuilderTestCase{
|
||||||
|
{"proc", new(Ops).Proc(MustAbs("/proc/")), Ops{
|
||||||
|
&MountProcOp{Target: MustAbs("/proc/")},
|
||||||
|
}},
|
||||||
|
})
|
||||||
|
|
||||||
|
checkOpIs(t, []opIsTestCase{
|
||||||
|
{"zero", new(MountProcOp), new(MountProcOp), false},
|
||||||
|
|
||||||
|
{"target differs", &MountProcOp{
|
||||||
|
Target: MustAbs("/proc/nonexistent"),
|
||||||
|
}, &MountProcOp{
|
||||||
|
Target: MustAbs("/proc/"),
|
||||||
|
}, false},
|
||||||
|
|
||||||
|
{"equals", &MountProcOp{
|
||||||
|
Target: MustAbs("/proc/"),
|
||||||
|
}, &MountProcOp{
|
||||||
|
Target: MustAbs("/proc/"),
|
||||||
|
}, true},
|
||||||
|
})
|
||||||
|
|
||||||
|
checkOpMeta(t, []opMetaTestCase{
|
||||||
|
{"proc", &MountProcOp{Target: MustAbs("/proc/")},
|
||||||
|
"mounting", `proc on "/proc/"`},
|
||||||
|
})
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user