-
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.
testinfra (#44): improved tests and draft of documentation
- Loading branch information
Showing
3 changed files
with
69 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
# AP-ALB tests | ||
|
||
The files on directory `ap-application-load-balancer/tests` by default will be | ||
be sincronized and be avalible on each host ALB node `/opt/alb/bin/tests/`. | ||
|
||
Note, the tests will NOT be installed if a node is not installed as `alb-standard` | ||
e.g. is installed as `alb-minimal` since `alb-minimal` do not create `/opt/alb/` | ||
folder structure. | ||
|
||
```bash | ||
py.test ad-hoc-alb-tests/test_alb-standard-node.py --hosts='ansible://all' | ||
py.test tests/test_alb-standard-node.py --ssh-identity-file="~/.ssh/id_rsa-rocha" --hosts="root@aguia-pescadora-foxtrot.etica.ai" | ||
``` | ||
|
||
|
||
## How to run | ||
|
||
### Extra backends | ||
- <https://testinfra.readthedocs.io/en/latest/backends.html> |
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,32 +1,36 @@ | ||
# FILE: /opt/alb/bin/tests/test_alb-standard-node.py | ||
|
||
def test_passwd_file(host): | ||
passwd = host.file("/etc/passwd") | ||
assert passwd.contains("root") | ||
assert passwd.user == "root" | ||
assert passwd.group == "root" | ||
assert passwd.mode == 0o644 | ||
def test_haproxy_is_installed(host): | ||
assert host.package("haproxy").is_installed | ||
|
||
|
||
def test_haproxy_is_enabled(host): | ||
assert host.service("haproxy").is_enabled | ||
|
||
|
||
def test_haproxy_is_running(host): | ||
assert host.service("haproxy").is_running | ||
|
||
|
||
def test_openresty_is_installed(host): | ||
nginx = host.package("openresty") | ||
assert nginx.is_installed | ||
# assert nginx.version.startswith("1.2") | ||
assert host.package("openresty").is_installed | ||
|
||
|
||
def test_openresty_running_and_enabled(host): | ||
nginx = host.service("openresty") | ||
assert nginx.is_running | ||
assert nginx.is_enabled | ||
def test_openresty_is_enabled(host): | ||
assert host.service("openresty").is_enabled | ||
|
||
|
||
def test_haproxy_is_installed(host): | ||
nginx = host.package("haproxy") | ||
assert nginx.is_installed | ||
# assert nginx.version.startswith("1.2") | ||
def test_openresty_is_running(host): | ||
assert host.service("openresty").is_running | ||
|
||
|
||
def test_ufw_is_installed(host): | ||
assert host.package("ufw").is_installed | ||
|
||
|
||
def test_ufw_is_enabled(host): | ||
assert host.service("ufw").is_enabled | ||
|
||
|
||
def test_haproxy_running_and_enabled(host): | ||
nginx = host.service("haproxy") | ||
assert nginx.is_running | ||
assert nginx.is_enabled | ||
def test_ufw_is_running(host): | ||
assert host.service("ufw").is_running |