← Back to team overview

ubuntu-server-ec2-testing-dev team mailing list archive

[Merge] lp:~daniel-thewatkins/ubuntu-server-ec2-testing/transfer_all_tests into lp:ubuntu-server-ec2-testing

 

Daniel Watkins has proposed merging lp:~daniel-thewatkins/ubuntu-server-ec2-testing/transfer_all_tests into lp:ubuntu-server-ec2-testing.

Requested reviews:
  Ben Howard (utlemming)

For more details, see:
https://code.launchpad.net/~daniel-thewatkins/ubuntu-server-ec2-testing/transfer_all_tests/+merge/234783

Currently the test harness (ubuntu-server-ec2-testing) copies only a script (global/execute_tests.sh) from the tests it is provided (generally ec2-automated-tests) to the host under test. This script then branches lp:ec2-automated-tests on the host (rather than the branch from which it was derived). When testing locally, you can modify the script that is to be copied, but this means that it is difficult to run any tests but lp:ec2-automated-tests on Jenkins.

This change means that it copies up _all_ the tests that it is provided with, and then runs global/execute_tests.sh. The current execute_tests.sh continues to work, but this will allow me to (in a separate change), modify it to use the tests that have been pushed to the server rather than re-branching them.

This code is running at https://jerff.canonical.com/job/Cloud-Test-EC2-14.10-Refactor-Test/ with the standard upstream ec2-automated-tests.
-- 
https://code.launchpad.net/~daniel-thewatkins/ubuntu-server-ec2-testing/transfer_all_tests/+merge/234783
Your team Ubuntu Server ec2 Testing Developers is subscribed to branch lp:ubuntu-server-ec2-testing.
=== modified file 'src/ubuntu/ec2/testing.py'
--- src/ubuntu/ec2/testing.py	2014-03-27 18:36:45 +0000
+++ src/ubuntu/ec2/testing.py	2014-09-16 09:10:58 +0000
@@ -90,7 +90,7 @@
     This class encapsulates a Machine Image
     '''
     STR_FORMAT = '''
-        MachineImage: 
+        MachineImage:
             - release:       %s
             - variant:       %s
             - release_type:  %s
@@ -780,22 +780,21 @@
             cmd = [ 'scp', '-B', '-i', '%s.pem' % self.tce.uuid, '-o',
                     'UserKnownHostsFile=%s/host.keys' % self.working_dir,
                     '-o', 'ConnectTimeout=180',
-                    os.path.join(self.tce.test_case.test_dir,
-                                 EXECUTE_TESTS_SH),
-                    'ubuntu@%s:/tmp/execute_tests.sh' % self.instance.dns_name]
+                    '-r', self.tce.test_case.test_dir,
+                    'ubuntu@{}:/tmp/ec2-tests'.format(self.instance.dns_name)]
             logging.debug('Executing command: %s', cmd)
             # If /tmp/done not retrieved test case still running
             if (subprocess.call(cmd) != 0):
                 raise TestException("Unable to deploy test executor to instance")
 
-            cmd = [ 'ssh', '-i', '%s.pem' % self.tce.uuid, '-o',
-                    'UserKnownHostsFile=%s/host.keys' % self.working_dir,
-                    'ubuntu@%s' % self.instance.dns_name,
-                    '/tmp/execute_tests.sh', self.tce.test_case.name,
-                    self.instance.id ]
+            cmd = (
+                'ssh -i {}.pem -o UserKnownHostsFile={}/host.keys ubuntu@{}'
+                ' "cd /tmp/ec2-tests; global/execute_tests.sh {} {}"'.format(
+                    self.tce.uuid, self.working_dir, self.instance.dns_name,
+                    self.tce.test_case.name, self.instance.id))
 
             logging.debug("Executing: %s",cmd)
-            if (subprocess.call(cmd) != 0):
+            if (subprocess.call(cmd, shell=True) != 0):
                 raise TestException("Unable to execute in-instance tests.")
 
             # Retrieve test results - should work now as /tmp/done


Follow ups