From f96ae038fb922bed49d75a7640205f1b364e4172 Mon Sep 17 00:00:00 2001 From: Spyros Seimenis Date: Wed, 8 Jan 2025 11:53:43 +0200 Subject: [PATCH] cmd/snap-bootstrap: add extra test for the wrong fsOpts type case --- .../initramfs_systemd_mount_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmd/snap-bootstrap/initramfs_systemd_mount_test.go b/cmd/snap-bootstrap/initramfs_systemd_mount_test.go index 2b381bd7cfb..ea7146dd590 100644 --- a/cmd/snap-bootstrap/initramfs_systemd_mount_test.go +++ b/cmd/snap-bootstrap/initramfs_systemd_mount_test.go @@ -670,3 +670,20 @@ Wants=%[1]s } } } + +type dummyOpts struct{} + +func (d dummyOpts) AppendOptions(strings []string) ([]string, error) { + return []string{"dummy options"}, nil +} + +func (s *doSystemdMountSuite) TestDoSystemdMountWrongFsOpts(c *C) { + + opts := &main.SystemdMountOptions{ + FsOpts: dummyOpts{}, + } + + err := main.DoSystemdMount("what", "where", opts) + c.Check(err, ErrorMatches, "cannot mount \"what\" at \"where\": invalid options") + +}