mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
Merge pull request #25841 from baude/initunits
Correct units in init error message
This commit is contained in:
@ -249,7 +249,7 @@ func checkMaxMemory(newMem strongunits.MiB) error {
|
||||
return err
|
||||
}
|
||||
if total := strongunits.B(memStat.Total); strongunits.B(memStat.Total) < newMem.ToBytes() {
|
||||
return fmt.Errorf("requested amount of memory (%d MB) greater than total system memory (%d MB)", newMem, total)
|
||||
return fmt.Errorf("requested amount of memory (%d MB) greater than total system memory (%d MB)", newMem, strongunits.ToMib(total))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -71,11 +71,12 @@ var _ = Describe("podman machine init", func() {
|
||||
// this comes in bytes
|
||||
memStat, err := mem.VirtualMemory()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
total := strongunits.ToMib(strongunits.B(memStat.Total)) + 1024
|
||||
systemMem := strongunits.ToMib(strongunits.B(memStat.Total))
|
||||
|
||||
badMem := initMachine{}
|
||||
badMemSession, err := mb.setCmd(badMem.withMemory(uint(total))).run()
|
||||
badMemSession, err := mb.setCmd(badMem.withMemory(uint(systemMem + 1024))).run()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(badMemSession.errorToString()).To(ContainSubstring(fmt.Sprintf("greater than total system memory (%d MB)", systemMem)))
|
||||
Expect(badMemSession).To(Exit(125))
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user