-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stop relaying on handlers to install global packages, and improve the…
… whole process in general. Better testing + include Focal Fossa as a supported target
- Loading branch information
1 parent
994073d
commit 7d2a146
Showing
6 changed files
with
72 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ galaxy_info: | |
- trusty | ||
- xenial | ||
- bionic | ||
- focal | ||
- name: Debian | ||
versions: | ||
- stretch | ||
|
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,42 +1,66 @@ | ||
import os | ||
import time | ||
|
||
|
||
import testinfra.utils.ansible_runner | ||
|
||
# let the which-checking crontab run | ||
# anyone know better way of checking what cron thinks ? Please, do let me know! | ||
time.sleep(61) | ||
|
||
# man handle the damn 20.04's sudo bug... | ||
FOCAL_BUG_STR = 'sudo: setrlimit(RLIMIT_CORE): Operation not permitted\n' | ||
|
||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | ||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') | ||
|
||
|
||
def test_node_version_ok(host): | ||
cmd = host.run("node -v") | ||
assert cmd.stderr == '' | ||
assert cmd.stdout.rstrip() == 'v8.11.3' | ||
assert cmd.stdout.rstrip() == 'v10.16.3' | ||
|
||
|
||
def test_global_gulp_version_ok(host): | ||
def test_global_libraries(host): | ||
cmd = host.run("gulp -v") | ||
assert cmd.stderr == '' | ||
assert 'CLI version' in cmd.stdout | ||
|
||
cmd = host.run("sudo -u www-data which gulp") | ||
cmd = host.run("lighthouse --version") | ||
assert cmd.stderr == '' | ||
assert cmd.stdout.rstrip() == '/usr/bin/gulp' | ||
assert cmd.stdout != '' | ||
|
||
with host.sudo("nvm_tester"): | ||
cmd = host.run("which lighthouse") | ||
assert cmd.stderr == '' or cmd.stderr == FOCAL_BUG_STR | ||
assert cmd.stdout.rstrip() == '/usr/bin/lighthouse' | ||
|
||
cmd = host.run("which gulp") | ||
assert cmd.stderr == '' or cmd.stderr == FOCAL_BUG_STR | ||
assert cmd.stdout.rstrip() == '/usr/bin/gulp' | ||
|
||
|
||
def test_cron_environment_for_global_libs(host): | ||
|
||
# make sure cron sees global libraries in correct locations | ||
assert host.run("cat /tmp/which_gulp").stdout.rstrip() == '/usr/bin/gulp' | ||
assert host.run("cat /tmp/which_lighthouse").stdout.rstrip() == '/usr/bin/lighthouse' | ||
|
||
|
||
def test_user_node_version_ok(host): | ||
with host.sudo("nvm_tester"): | ||
cmd = host.run("node -v") | ||
assert cmd.stderr == '' or cmd.stderr == FOCAL_BUG_STR | ||
assert cmd.stdout.rstrip() == 'v10.16.3' | ||
|
||
|
||
def test_npm_ok(host): | ||
cmd = host.run("npm -v") | ||
assert cmd.stdout.rstrip() == '5.6.0' | ||
assert cmd.stdout.rstrip() == '6.9.0' | ||
|
||
|
||
def test_user_npm_ok(host): | ||
with host.sudo("nvm_tester"): | ||
host.check_output("whoami") | ||
cmd = host.run("npm -v") | ||
assert cmd.stdout.rstrip() == '5.6.0' | ||
|
||
|
||
def test_user_node_version_ok(host): | ||
with host.sudo("nvm_tester"): | ||
cmd = host.run("node -v") | ||
assert cmd.stderr == '' | ||
assert cmd.stdout.rstrip() == 'v8.11.3' | ||
assert cmd.stdout.rstrip() == '6.9.0' |
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