mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-09-16 22:50:47 +00:00
Add shim to choose next entry to boot from (#230)
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
type SyscallInterface interface {
|
||||
Chroot(string) error
|
||||
Chdir(string) error
|
||||
Mount(string, string, string, uintptr, string) error
|
||||
}
|
||||
|
||||
type RealSyscall struct{}
|
||||
@@ -34,3 +35,6 @@ func (r *RealSyscall) Chroot(path string) error {
|
||||
func (r *RealSyscall) Chdir(path string) error {
|
||||
return syscall.Chdir(path)
|
||||
}
|
||||
func (r *RealSyscall) Mount(source string, target string, fstype string, flags uintptr, data string) error {
|
||||
return syscall.Mount(source, target, fstype, flags, data)
|
||||
}
|
||||
|
@@ -44,4 +44,14 @@ var _ = Describe("Syscall", Label("types", "syscall"), func() {
|
||||
// We need elevated privs to chroot so this should fail
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
It("Calling mount on the fake syscall should not fail", func() {
|
||||
r := v1mock.FakeSyscall{}
|
||||
err := r.Mount("source", "target", "fstype", 0, "data")
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
It("Calling mount on the real syscall fail (wrong args)", func() {
|
||||
r := v1.RealSyscall{}
|
||||
err := r.Mount("source", "target", "fstype", 0, "data")
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user