summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-02-18 18:49:28 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-02-18 18:49:28 +0000
commitb3817bc521683faf3a181ed34f8252807adf3858 (patch)
treebe190519f6edb64bb403e9ba7afb818c5df22e1d
parentbc34ec414f562d1934d6662eb9b4857116b26baf (diff)
downloadsystem-tests-b3817bc521683faf3a181ed34f8252807adf3858.tar.gz
Add kernel upgrade test
-rw-r--r--test_trove_upgrades.py86
1 files changed, 85 insertions, 1 deletions
diff --git a/test_trove_upgrades.py b/test_trove_upgrades.py
index 75580e2..111bde4 100644
--- a/test_trove_upgrades.py
+++ b/test_trove_upgrades.py
@@ -650,6 +650,89 @@ class TestUpgrades(BaseTestSuite):
# check you can issue Gitano commands ...
# perhaps crib from Gitano test suite
+ @contextlib.contextmanager
+ def given_trove_instance_with_old_kernel(self, vm_name, fixture_dir, reuse=False):
+ '''
+ GIVEN a running current Trove system but with Linux 3.6
+ '''
+ if reuse:
+ branch = SystemTestBranch(fixture_dir, 'old')
+ instance = TroveInitialDeployment(branch, vm_name)
+ instance.admin_id = os.path.join(branch.morphs_dir, 'testuser.key')
+ else:
+ branch = self.create_system_branch(fixture_dir, 'old')
+ branch.set_chunk_version(
+ system='trove-system-x86_64', stratum='bsp-x86_64-generic',
+ chunk='linux', tag='v3.6')
+
+ instance = TroveInitialDeployment(branch, vm_name)
+ instance.create_config()
+ instance.run_build()
+ instance.run_deploy(autostart=True)
+
+ cliapp.runcmd(['ssh-add', instance.admin_id])
+
+ try:
+ self.wait_for_machine_to_boot(instance)
+
+ yield instance
+ finally:
+ # Should pass the .pub file really ...
+ cliapp.runcmd(['ssh-add', '-d', instance.admin_id])
+
+ def test_scenario_trove_kernel_upgrade(self, vm_name, fixture_dir,
+ workspace_dir, reuse_fixture=False):
+ '''
+ The kernel requires special treatment by the upgrade mechanism because
+ it is the first thing that loads.
+
+ SCENARIO Bob upgrades his Trove (vague version)
+ GIVEN a Trove system with Linux 3.6
+ WHEN Bob builds and upgrades to the current version of Trove with
+ AUTOSTART=1
+ THEN the Trove uses the standard version of Linux used Baserock master
+
+ '''
+
+ with self.given_trove_instance_with_old_kernel(
+ vm_name, fixture_dir, reuse=reuse_fixture) as instance:
+ branch = self.create_system_branch(workspace_dir, 'current')
+
+ test_url = 'ssh://root@%s/' % vm_name
+
+ old_uname_output = remote_runcmd(
+ test_url, ['uname', '--kernel-release'])
+ print "uname output: %s" % old_uname_output
+
+ upgrade = TroveUpgrade(branch, vm_name)
+ upgrade.create_config(instance, upgrade_method='ssh-rsync',
+ version_label='trove-current')
+ upgrade.run_build()
+ upgrade.run_deploy(autostart=True)
+
+ self.wait_for_machine_to_boot(instance)
+
+ new_uname_output = remote_runcmd(
+ test_url, ['uname', '--kernel-release'])
+ print "uname output: %s" % new_uname_output
+
+ try:
+ remote_runcmd(test_url,
+ ['snapshot-mgr', 'set-default', 'factory'])
+ remote_runcmd(test_url, ['reboot'])
+ except cliapp.AppException:
+ # Bit of a hack because we get disconnect before the command
+ # exits so SSH returns failure.
+ pass
+
+ self.wait_for_machine_to_boot(instance)
+ rollback_uname_output = remote_runcmd(
+ test_url, ['uname', '--kernel-release'])
+
+ print "OLD uname outout: %s" % old_uname_output
+ print "NEW uname outout: %s" % new_uname_output
+ print "RBK uname output: %s" % rollback_uname_output
+
def test_scenario_trove_upgrade_shared_user_data(
self, vm_name, fixture_dir, workspace_dir, reuse_fixture=False):
'''
@@ -755,7 +838,8 @@ class SimpleTestRunner(cliapp.Application):
self.run_test()
def run_test(self):
- test = TestUpgrades().test_scenario_trove_upgrade
+ #test = TestUpgrades().test_scenario_trove_upgrade
+ test = TestUpgrades().test_scenario_trove_kernel_upgrade
if self.settings['reuse-fixture'] is not None:
fixture_dir = self.settings['reuse-fixture']