diff --git a/tests/platform_tests/test_memory_exhaustion.py b/tests/platform_tests/test_memory_exhaustion.py index b829baab406..141df3dc657 100644 --- a/tests/platform_tests/test_memory_exhaustion.py +++ b/tests/platform_tests/test_memory_exhaustion.py @@ -64,6 +64,12 @@ def test_memory_exhaustion(self, duthosts, enum_rand_one_per_hwsku_hostname, loc # background process. # * Some DUTs with few free memory may reboot before ansible receive the result of shell # command, so we add `sleep 5` to ensure ansible receive the result first. + # Swapping is turned off so the OOM is triggered in a shorter time. + + res = duthost.command("sudo swapoff -a") + if res['rc']: + logging.error("Swapoff command failed: {}".format(res)) + cmd = 'nohup bash -c "sleep 5 && tail /dev/zero" &' res = duthost.shell(cmd) if not res.is_successful: