Sometimes when controller process cleanup happens concurrently with testbed teardown...
[nepi.git] / test / testbeds / planetlab / integration.py
index 05c4bd3..0edcb1e 100755 (executable)
@@ -18,12 +18,20 @@ class PlanetLabIntegrationTestCase(unittest.TestCase):
         self.root_dir = tempfile.mkdtemp()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
     def make_experiment_desc(self):
         testbed_id = "planetlab"
         testbed_version = "01"
         slicename = "inria_nepi12"
+        pl_ssh_key = os.environ.get(
+            "PL_SSH_KEY",
+            "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'],) )
         pl_user, pl_pwd = test_util.pl_auth()
 
         exp_desc = ExperimentDescription()
@@ -31,7 +39,7 @@ class PlanetLabIntegrationTestCase(unittest.TestCase):
         pl_desc = exp_desc.add_testbed_description(pl_provider)
         pl_desc.set_attribute_value("homeDirectory", self.root_dir)
         pl_desc.set_attribute_value("slice", slicename)
-        pl_desc.set_attribute_value("sliceSSHKey", "/user/%s/home/.ssh/id_rsa_planetlab" % (getpass.getuser(),))
+        pl_desc.set_attribute_value("sliceSSHKey", pl_ssh_key)
         pl_desc.set_attribute_value("authUser", pl_user)
         pl_desc.set_attribute_value("authPass", pl_pwd)