From 4c490135c08341cbdb7271dfe05f27052f946e8c Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Mon, 2 Dec 2024 09:31:58 +0100 Subject: [PATCH] gadget: fix unit tests after rebasing --- gadget/gadget_emmc_test.go | 6 +++--- gadget/install/install_test.go | 11 +---------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/gadget/gadget_emmc_test.go b/gadget/gadget_emmc_test.go index ad97fc3144d..03a42ab2e6f 100644 --- a/gadget/gadget_emmc_test.go +++ b/gadget/gadget_emmc_test.go @@ -345,7 +345,7 @@ func (s *gadgetYamlEMMCSuite) TestUpdateApplyHappy(c *C) { rollbackDir := c.MkDir() - restore := gadget.MockVolumeStructureToLocationMap(func(gd gadget.GadgetData, gm gadget.Model, gv map[string]*gadget.Volume) (map[string]map[int]gadget.StructureLocation, map[string]map[int]*gadget.OnDiskStructure, error) { + restore := gadget.MockVolumeStructureToLocationMap(func(_ gadget.Model, _, newVolumes map[string]*gadget.Volume) (map[string]map[int]gadget.StructureLocation, map[string]map[int]*gadget.OnDiskStructure, error) { return map[string]map[int]gadget.StructureLocation{ "volumename": { 0: { @@ -363,8 +363,8 @@ func (s *gadgetYamlEMMCSuite) TestUpdateApplyHappy(c *C) { }, }, }, map[string]map[int]*gadget.OnDiskStructure{ - "volumename": gadget.OnDiskStructsFromGadget(gd.Info.Volumes["volumename"]), - "my-emmc": gadget.OnDiskStructsFromGadget(gd.Info.Volumes["my-emmc"]), + "volumename": gadget.OnDiskStructsFromGadget(newVolumes["volumename"]), + "my-emmc": gadget.OnDiskStructsFromGadget(newVolumes["my-emmc"]), }, nil }) defer restore() diff --git a/gadget/install/install_test.go b/gadget/install/install_test.go index bc841b9e299..760f5510864 100644 --- a/gadget/install/install_test.go +++ b/gadget/install/install_test.go @@ -102,11 +102,6 @@ func (s *installSuite) TestVolumeAssignmentDeviceNameMissing(c *C) { DevNode: "/dev/fakedevice0", DevPath: "/sys/block/fakedevice0", }, - filepath.Join(s.dir, "/dev/fakedevice1p1"): { - DevNum: "43:0", - DevNode: "/dev/fakedevice1", - DevPath: "/sys/block/fakedevice1", - }, } restore := disks.MockPartitionDeviceNodeToDiskMapping(m) @@ -120,11 +115,7 @@ func (s *installSuite) TestVolumeAssignmentDeviceNameMissing(c *C) { c.Assert(err, IsNil) _, err = install.Run(uc20Mod, gadgetRoot, &install.KernelSnapInfo{}, "", install.Options{}, nil, timings.New(nil)) - c.Assert(err, ErrorMatches, ` ------ -stderr: -Unknown device "/dev/disk/by-path/pci-43:0": No such file or directory ------`) + c.Assert(err, ErrorMatches, `device name "/dev/fakedevice1" not mocked`) } func (s *installSuite) TestInstallSeedDiskDoesNotMatchAssignedDisk(c *C) {