Skip to content

Commit

Permalink
Fix trivial test failures caused by string changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rfjakob committed Apr 16, 2024
1 parent 5402cf9 commit bfde82c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions testsuite_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ func TestCli(t *testing.T) {
{args: []string{"xyz"}, code: 13, stderrContains: "extra argument not understood", stdoutEmpty: true},
{args: []string{"-i", "1"}, code: 13, stderrContains: "extra argument not understood", stdoutEmpty: true},
// Tuples
{args: []string{"-m", "2,1"}, code: -1, stderrContains: "sending SIGTERM when mem <= 2.00% and swap <= 10.00%", stdoutContains: memReport},
{args: []string{"-m", "2,1"}, code: -1, stderrContains: "sending SIGTERM when mem avail <= 2.00% and swap free <= 10.00%", stdoutContains: memReport},
{args: []string{"-m", "1,2"}, code: -1, stdoutContains: memReport},
{args: []string{"-m", "1,-1"}, code: 15, stderrContains: "fatal", stdoutEmpty: true},
{args: []string{"-m", "1000,-1000"}, code: 15, stderrContains: "fatal", stdoutEmpty: true},
{args: []string{"-s", "2,1"}, code: -1, stderrContains: "sending SIGTERM when mem <= 10.00% and swap <= 2.00%", stdoutContains: memReport},
{args: []string{"-s", "2,1"}, code: -1, stderrContains: "sending SIGTERM when mem avail <= 10.00% and swap free <= 2.00%", stdoutContains: memReport},
{args: []string{"-s", "1,2"}, code: -1, stdoutContains: memReport},
// https://github.com/rfjakob/earlyoom/issues/97
{args: []string{"-m", "5,0"}, code: -1, stdoutContains: memReport},
Expand All @@ -135,18 +135,18 @@ func TestCli(t *testing.T) {
{args: []string{"-s", tooBigInt32}, code: 16, stderrContains: "fatal", stdoutEmpty: true},
{args: []string{"-s", tooBigUint32}, code: 16, stderrContains: "fatal", stdoutEmpty: true},
// Floating point values
{args: []string{"-m", "3.14"}, code: -1, stderrContains: "SIGTERM when mem <= 3.14%", stdoutContains: memReport},
{args: []string{"-m", "7,3.14"}, code: -1, stderrContains: "SIGKILL when mem <= 3.14%", stdoutContains: memReport},
{args: []string{"-s", "12.34"}, code: -1, stderrContains: "swap <= 12.34%", stdoutContains: memReport},
{args: []string{"-m", "3.14"}, code: -1, stderrContains: "SIGTERM when mem avail <= 3.14%", stdoutContains: memReport},
{args: []string{"-m", "7,3.14"}, code: -1, stderrContains: "SIGKILL when mem avail <= 3.14%", stdoutContains: memReport},
{args: []string{"-s", "12.34"}, code: -1, stderrContains: "swap free <= 12.34%", stdoutContains: memReport},
// Use both -m/-M
{args: []string{"-m", "10", "-M", mem1percent}, code: -1, stderrContains: "SIGTERM when mem <= 1.00%", stdoutContains: memReport},
{args: []string{"-m", "10", "-M", mem1percent}, code: -1, stderrContains: "SIGTERM when mem avail <= 1.00%", stdoutContains: memReport},
}
if swapTotal > 0 {
// Tests that cannot work when there is no swap enabled
tc := []cliTestCase{
{args: []string{"-S", swap2percent}, code: -1, stderrContains: " 2.00%", stdoutContains: memReport},
// Use both -s/-S
{args: []string{"-s", "10", "-S", swap2percent}, code: -1, stderrContains: "swap <= 1.00%", stdoutContains: memReport},
{args: []string{"-s", "10", "-S", swap2percent}, code: -1, stderrContains: "swap free <= 1.00%", stdoutContains: memReport},
}
testcases = append(testcases, tc...)
}
Expand Down

0 comments on commit bfde82c

Please sign in to comment.