All checks were successful
		
		
	
	Test / Create distribution (push) Successful in 25s
				
			Test / Hakurei (push) Successful in 44s
				
			Test / Sandbox (push) Successful in 41s
				
			Test / Hakurei (race detector) (push) Successful in 44s
				
			Test / Sandbox (race detector) (push) Successful in 41s
				
			Test / Hpkg (push) Successful in 41s
				
			Test / Flake checks (push) Successful in 1m24s
				
			Most tests already had no global state, however parallel was never enabled. This change enables it for all applicable tests. Signed-off-by: Ophestra <cat@gensokyo.uk>
		
			
				
	
	
		
			64 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package container
 | |
| 
 | |
| import (
 | |
| 	"os"
 | |
| 	"testing"
 | |
| 
 | |
| 	"hakurei.app/container/check"
 | |
| 	"hakurei.app/container/stub"
 | |
| )
 | |
| 
 | |
| func TestMountProcOp(t *testing.T) {
 | |
| 	t.Parallel()
 | |
| 
 | |
| 	checkOpBehaviour(t, []opBehaviourTestCase{
 | |
| 		{"mkdir", &Params{ParentPerm: 0755},
 | |
| 			&MountProcOp{
 | |
| 				Target: check.MustAbs("/proc/"),
 | |
| 			}, nil, nil, []stub.Call{
 | |
| 				call("mkdirAll", stub.ExpectArgs{"/sysroot/proc", os.FileMode(0755)}, nil, stub.UniqueError(0)),
 | |
| 			}, stub.UniqueError(0)},
 | |
| 
 | |
| 		{"success", &Params{ParentPerm: 0700},
 | |
| 			&MountProcOp{
 | |
| 				Target: check.MustAbs("/proc/"),
 | |
| 			}, nil, nil, []stub.Call{
 | |
| 				call("mkdirAll", stub.ExpectArgs{"/sysroot/proc", os.FileMode(0700)}, nil, nil),
 | |
| 				call("mount", stub.ExpectArgs{"proc", "/sysroot/proc", "proc", uintptr(0xe), ""}, nil, nil),
 | |
| 			}, nil},
 | |
| 	})
 | |
| 
 | |
| 	checkOpsValid(t, []opValidTestCase{
 | |
| 		{"nil", (*MountProcOp)(nil), false},
 | |
| 		{"zero", new(MountProcOp), false},
 | |
| 		{"valid", &MountProcOp{Target: check.MustAbs("/proc/")}, true},
 | |
| 	})
 | |
| 
 | |
| 	checkOpsBuilder(t, []opsBuilderTestCase{
 | |
| 		{"proc", new(Ops).Proc(check.MustAbs("/proc/")), Ops{
 | |
| 			&MountProcOp{Target: check.MustAbs("/proc/")},
 | |
| 		}},
 | |
| 	})
 | |
| 
 | |
| 	checkOpIs(t, []opIsTestCase{
 | |
| 		{"zero", new(MountProcOp), new(MountProcOp), false},
 | |
| 
 | |
| 		{"target differs", &MountProcOp{
 | |
| 			Target: check.MustAbs("/proc/nonexistent"),
 | |
| 		}, &MountProcOp{
 | |
| 			Target: check.MustAbs("/proc/"),
 | |
| 		}, false},
 | |
| 
 | |
| 		{"equals", &MountProcOp{
 | |
| 			Target: check.MustAbs("/proc/"),
 | |
| 		}, &MountProcOp{
 | |
| 			Target: check.MustAbs("/proc/"),
 | |
| 		}, true},
 | |
| 	})
 | |
| 
 | |
| 	checkOpMeta(t, []opMetaTestCase{
 | |
| 		{"proc", &MountProcOp{Target: check.MustAbs("/proc/")},
 | |
| 			"mounting", `proc on "/proc/"`},
 | |
| 	})
 | |
| }
 |