-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4099 from freedomofpress/3964-testinfra-for-xenial
Ensures config test coverage for Xenial
- Loading branch information
Showing
30 changed files
with
471 additions
and
408 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,37 +1,37 @@ | ||
testinfra_hosts = ["app-staging"] | ||
|
||
|
||
def test_haveged_config(File): | ||
def test_haveged_config(host): | ||
""" | ||
Ensure haveged's low entrop watermark is sufficiently high. | ||
""" | ||
f = File('/etc/default/haveged') | ||
f = host.file('/etc/default/haveged') | ||
assert f.is_file | ||
assert f.user == 'root' | ||
assert f.group == 'root' | ||
assert oct(f.mode) == '0644' | ||
assert f.contains('^DAEMON_ARGS="-w 2400"$') | ||
|
||
|
||
def test_haveged_no_duplicate_lines(Command): | ||
def test_haveged_no_duplicate_lines(host): | ||
""" | ||
Regression test to check for duplicate entries. Earlier playbooks | ||
for configuring the SD instances needlessly appended the `DAEMON_ARGS` | ||
line everytime the playbook was run. Fortunately the duplicate lines don't | ||
break the service, but it's still poor form. | ||
""" | ||
c = Command("uniq --repeated /etc/default/haveged") | ||
c = host.run("uniq --repeated /etc/default/haveged") | ||
assert c.rc == 0 | ||
assert c.stdout == "" | ||
|
||
|
||
def test_haveged_is_running(Service, Sudo): | ||
def test_haveged_is_running(host): | ||
""" | ||
Ensure haveged service is running, to provide additional entropy. | ||
""" | ||
# Sudo is necessary to read /proc when running under grsecurity, | ||
# sudo is necessary to read /proc when running under grsecurity, | ||
# which the App hosts do. Not technically necessary under development. | ||
with Sudo(): | ||
s = Service("haveged") | ||
with host.sudo(): | ||
s = host.service("haveged") | ||
assert s.is_running | ||
assert s.is_enabled |
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.