From: Claudio-Daniel Freire Date: Fri, 22 Apr 2011 11:56:42 +0000 (+0200) Subject: Make PlanetLabs easily runnable (environment variables for user/pass) X-Git-Tag: nepi_v2~131 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=8aa637060e5056a9f7d745589be168a5db077db6;p=nepi.git Make PlanetLabs easily runnable (environment variables for user/pass) --- diff --git a/test/lib/test_util.py b/test/lib/test_util.py index 1065b90d..87e22c36 100644 --- a/test/lib/test_util.py +++ b/test/lib/test_util.py @@ -51,6 +51,14 @@ def ns3_usable(): return True +def pl_auth(): + user = os.environ.get('PL_USER') + pwd = os.environ.get('PL_PASS') + + if user and pwd: + return (user,pwd) + else: + return None def find_bin(name, extra_path = None): search = [] diff --git a/test/testbeds/planetlab/execute.py b/test/testbeds/planetlab/execute.py index 6acb331a..aab648d6 100755 --- a/test/testbeds/planetlab/execute.py +++ b/test/testbeds/planetlab/execute.py @@ -10,6 +10,7 @@ import tempfile import time import unittest import re +import test_util class NetnsExecuteTestCase(unittest.TestCase): def setUp(self): @@ -18,16 +19,18 @@ class NetnsExecuteTestCase(unittest.TestCase): def tearDown(self): shutil.rmtree(self.root_dir) - def interactive_test_simple(self): + @test_util.skipUnless(test_util.pl_auth() is not None, "Test requires PlanetLab authentication info (PL_USER and PL_PASS environment variables)") + def test_simple(self): testbed_version = "01" instance = planetlab.TestbedController(testbed_version) slicename = "inria_nepi12" + pl_user, pl_pwd = test_util.pl_auth() instance.defer_configure("homeDirectory", self.root_dir) instance.defer_configure("slice", slicename) instance.defer_configure("sliceSSHKey", "/user/%s/home/.ssh/id_rsa_planetlab" % (getpass.getuser(),)) - instance.defer_configure("authUser", "claudio-daniel.freire@inria.fr") - instance.defer_configure("authPass", getpass.getpass()) + instance.defer_configure("authUser", pl_user) + instance.defer_configure("authPass", pl_pwd) instance.defer_create(2, "Node") instance.defer_create_set(2, "hostname", "onelab11.pl.sophia.inria.fr")