Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: David Cassany <[email protected]>
  • Loading branch information
davidcassany committed Apr 29, 2024
1 parent f6c3b83 commit 2fb783e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/elemental/elemental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,8 @@ var _ = Describe("Elemental", Label("elemental"), func() {
Expect(err).ShouldNot(HaveOccurred())

relabelCmd = []string{
"setfiles", "-c", policyFile, "-e", "/dev", "-e", "/proc", "-e", "/sys",
"-F", constants.SELinuxTargetedContextFile, "/",
"setfiles", "-e", "/dev", "-e", "/proc", "-e", "/sys",
"-i", "-F", constants.SELinuxTargetedContextFile, "/",
}
})
It("does nothing if the context file is not found", func() {
Expand Down Expand Up @@ -929,7 +929,7 @@ var _ = Describe("Elemental", Label("elemental"), func() {
Expect(err).ShouldNot(HaveOccurred())

relabelCmd = []string{
"setfiles", "-c", policyFile, "-F", "-r", "/root", contextFile, "/root",
"setfiles", "-i", "-F", "-r", "/root", contextFile, "/root",
}

Expect(elemental.SelinuxRelabel(*config, "/root")).To(BeNil())
Expand Down
3 changes: 3 additions & 0 deletions pkg/snapshotter/btrfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var _ = Describe("Btrfs", Label("snapshotter", " btrfs"), func() {
var snapCfg types.SnapshotterConfig
var rootDir, efiDir string
var statePart *types.Partition
var syscall *mocks.FakeSyscall

BeforeEach(func() {
rootDir = "/some/root"
Expand All @@ -57,6 +58,7 @@ var _ = Describe("Btrfs", Label("snapshotter", " btrfs"), func() {
efiDir = constants.EfiDir
runner = mocks.NewFakeRunner()
mounter = mocks.NewFakeMounter()
syscall = &mocks.FakeSyscall{}
bootloader = &mocks.FakeBootloader{}
memLog = bytes.NewBuffer(nil)
logger = types.NewBufferLogger(memLog)
Expand All @@ -71,6 +73,7 @@ var _ = Describe("Btrfs", Label("snapshotter", " btrfs"), func() {
conf.WithRunner(runner),
conf.WithLogger(logger),
conf.WithMounter(mounter),
conf.WithSyscall(syscall),
conf.WithPlatform("linux/amd64"),
)
snapCfg = types.SnapshotterConfig{
Expand Down
3 changes: 3 additions & 0 deletions pkg/snapshotter/loopdevice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var _ = Describe("LoopDevice", Label("snapshotter", "loopdevice"), func() {
var snapCfg types.SnapshotterConfig
var rootDir, efiDir string
var statePart *types.Partition
var syscall *mocks.FakeSyscall

BeforeEach(func() {
rootDir = "/some/root"
Expand All @@ -55,6 +56,7 @@ var _ = Describe("LoopDevice", Label("snapshotter", "loopdevice"), func() {
efiDir = constants.EfiDir
runner = mocks.NewFakeRunner()
mounter = mocks.NewFakeMounter()
syscall = &mocks.FakeSyscall{}
bootloader = &mocks.FakeBootloader{}
memLog = bytes.NewBuffer(nil)
logger = types.NewBufferLogger(memLog)
Expand All @@ -69,6 +71,7 @@ var _ = Describe("LoopDevice", Label("snapshotter", "loopdevice"), func() {
conf.WithRunner(runner),
conf.WithLogger(logger),
conf.WithMounter(mounter),
conf.WithSyscall(syscall),
conf.WithPlatform("linux/amd64"),
)
snapCfg = types.NewLoopDevice()
Expand Down

0 comments on commit 2fb783e

Please sign in to comment.