[autotest] Add two helper functions to install packages.
Server-side test should call these two functions to install required packages.
Ideally, tests will not need to deploy packages to site-packages for test to
run.
BUG=chromium:453614
TEST=site_utils/lxc_functional_test.py
Change-Id: I9ade9e1a804897a32cebac36836367feda13a24b
Reviewed-on: https://chromium-review.googlesource.com/268437
Trybot-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
diff --git a/site_utils/lxc_functional_test.py b/site_utils/lxc_functional_test.py
index e3a8436..b8dc141 100644
--- a/site_utils/lxc_functional_test.py
+++ b/site_utils/lxc_functional_test.py
@@ -178,6 +178,16 @@
raise Exception('Failed to read status.log in container.')
+def test_package_install(container):
+ """Test installing package in container.
+
+ @param container: The test container.
+ """
+ container.attach_run('sudo apt-get update -y')
+ container.attach_run('sudo apt-get install python-pip -y')
+ container.attach_run('sudo pip install selenium')
+
+
def parse_options():
"""Parse command line inputs.
"""
@@ -213,6 +223,7 @@
container = setup_test(bucket, container_test_name, options.skip_cleanup)
test_share(container)
test_autoserv(container)
+ test_package_install(container)
logging.info('All tests passed.')