Skip to content

Commit 907f324

Browse files
praveenkumaranjannath
authored andcommitted
Relax RAM size checks in CRC status JSON output validation
The RAM size check now allows for up to 1 GiB less than the configured value, since `free -b` output reflects available memory after kernel and system overhead. These changes improve test reliability by avoiding false negatives during reporting.
1 parent 2af836f commit 907f324

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/e2e/testsuite/testsuite.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,11 @@ func CheckCRCStatusJSONOutput() error {
744744
return fmt.Errorf("failure in asserting 'diskSize' field of crc status json output, expected greater than or equal to %d bytes, actual : %d bytes", strongunits.GiB(constants.DefaultDiskSize).ToBytes(), strongunits.B(cast.ToUint64(crcDiskSize)))
745745
}
746746
crcRAMSize := crcStatusJSONOutputObj["ramSize"]
747-
if strongunits.B(cast.ToUint64(crcRAMSize)) < constants.GetDefaultMemory(crcPreset).ToBytes() {
747+
if strongunits.B(cast.ToUint64(crcRAMSize)) < (constants.GetDefaultMemory(crcPreset).ToBytes() - strongunits.GiB(1).ToBytes()) {
748+
// This is a workaround for the fact that crc status json output
749+
// which doesn't return the exact RAM size used to create the VM,
750+
// but rather the `free -b` output, which is less than the actual RAM size.
751+
// some amount of overhead memory used by the kernel and system components.
748752
return fmt.Errorf("failure in asserting 'ramSize' field of crc status json output, expected greater than or equal to %d bytes, actual : %d bytes", constants.GetDefaultMemory(crcPreset).ToBytes(), cast.ToUint64(crcRAMSize))
749753
}
750754
return nil

0 commit comments

Comments
 (0)