boot, bootloader: tweak naming of panic injection helper

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
This commit is contained in:
Maciej Borzecki
2021-04-19 13:27:10 +02:00
parent 3c3513a155
commit abb058121f
3 changed files with 5 additions and 5 deletions

View File

@@ -130,7 +130,7 @@ func (s *bootenv20Suite) checkBootStateAfterUnexpectedRebootAndCleanup(
) {
if panicFunc != "" {
// setup a panic during the given bootloader function
restoreBootloaderPanic := s.bootloader.SetMockPanic(panicFunc)
restoreBootloaderPanic := s.bootloader.SetMockToPanic(panicFunc)
// run the boot function that will now panic
c.Assert(

View File

@@ -3800,7 +3800,7 @@ func (s *bootKernelCommandLineSuite) TestCommandLineUpdateUC20OverSpuriousReboot
c.Assert(err, IsNil)
s.bootloader.SetBootVarsCalls = 0
restoreBootloaderNoPanic := s.bootloader.SetMockPanic("SetBootVars")
restoreBootloaderNoPanic := s.bootloader.SetMockToPanic("SetBootVars")
// transition to gadget with cmdline.extra
sf := snaptest.MakeTestSnapWithFiles(c, gadgetSnapYaml, [][]string{

View File

@@ -148,13 +148,13 @@ func (b *MockBootloader) InstallBootConfig(gadgetDir string, opts *bootloader.Op
return b.InstallBootConfigErr
}
// SetMockPanic allows setting any method in the Bootloader interface or derived
// SetMockToPanic allows setting any method in the Bootloader interface or derived
// interface to panic instead of returning. This allows one to test what would
// happen if the system was rebooted during execution of a particular function.
// Specifically, the panic will be done immediately entering the function so
// setting SetBootVars to panic will emulate a reboot before any boot vars are
// set persistently
func (b *MockBootloader) SetMockPanic(f string) (restore func()) {
func (b *MockBootloader) SetMockToPanic(f string) (restore func()) {
switch f {
// XXX: update this list as more calls in this interface or derived ones
// are added
@@ -167,7 +167,7 @@ func (b *MockBootloader) SetMockPanic(f string) (restore func()) {
b.panicMethods[f] = old
}
default:
panic(fmt.Sprintf("unknown ExtractedRunKernelImageBootloader method %q to mock reboot via panic for", f))
panic(fmt.Sprintf("unknown bootloader method %q to mock reboot via panic for", f))
}
}