forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
591 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,43 @@ | ||
import ./make-test-python.nix ({ lib, ... }: { | ||
name = "earlyoom"; | ||
meta = { | ||
maintainers = with lib.maintainers; [ ncfavier AndersonTorres ]; | ||
}; | ||
|
||
machine = { | ||
services.earlyoom = { | ||
enable = true; | ||
import ./make-test-python.nix ( | ||
{ lib, ... }: | ||
{ | ||
name = "earlyoom"; | ||
meta = { | ||
maintainers = with lib.maintainers; [ | ||
ncfavier | ||
AndersonTorres | ||
oxalica | ||
]; | ||
}; | ||
}; | ||
|
||
testScript = '' | ||
machine.wait_for_unit("earlyoom.service") | ||
''; | ||
}) | ||
nodes.machine = | ||
{ pkgs, ... }: | ||
{ | ||
# Limit VM resource usage. | ||
virtualisation.memorySize = 1024; | ||
|
||
services.earlyoom = { | ||
enable = true; | ||
# Use SIGKILL, or `tail` will catch SIGTERM and exit successfully. | ||
freeMemKillThreshold = 90; | ||
}; | ||
|
||
systemd.services.testbloat = { | ||
description = "Create a lot of memory pressure"; | ||
serviceConfig = { | ||
ExecStart = "${pkgs.coreutils}/bin/tail /dev/zero"; | ||
}; | ||
}; | ||
}; | ||
|
||
testScript = '' | ||
machine.wait_for_unit("earlyoom.service") | ||
with subtest("earlyoom should kill the bad service"): | ||
machine.fail("systemctl start --wait testbloat.service") | ||
assert machine.get_unit_info("testbloat.service")["Result"] == "signal" | ||
output = machine.succeed('journalctl -u earlyoom.service -b0') | ||
assert 'low memory! at or below SIGKILL limits' in output | ||
''; | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.