From 52cb0f3bb90b1dadb53b2702be6c3bd43f115f11 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 18 Feb 2014 15:39:59 +0000 Subject: Use morph deploy's AUTOSTART flag instead of rebooting manually --- test_trove_upgrades.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/test_trove_upgrades.py b/test_trove_upgrades.py index ea95b91..f90cbb9 100644 --- a/test_trove_upgrades.py +++ b/test_trove_upgrades.py @@ -169,10 +169,11 @@ class Deployment(object): run_morph( ['build', self.system_morph_name], cwd=self.branch.branch_dir) - def run_deploy(self): + def run_deploy(self, autostart=False): + autostart_param = \ + '%s.AUTOSTART=%s' % (self.vm_name, 'yes' if autostart else 'no') run_morph( - ['deploy', self.deploy_morph_name, - '%s.AUTOSTART=yes' % self.vm_name], + ['deploy', self.deploy_morph_name, autostart_param], cwd=self.branch.branch_dir) def create_ssh_key(self, key_name): @@ -291,11 +292,12 @@ class TroveUpgrade(Deployment): 'trove-system-x86_64', 'trove-test-upgrade', systembranch, vm_name) - def run_deploy(self): + def run_deploy(self, autostart=False): + autostart_param = \ + '%s.AUTOSTART=%s' % (self.vm_name, 'yes' if autostart else 'no') run_morph( ['deploy', self.deploy_morph_name, - '--upgrade', - '%s.AUTOSTART=yes' % self.vm_name], + '--upgrade', autostart_param], cwd=self.branch.branch_dir) def create_config(self, initial_deployment, upgrade_method='ssh-rsync', @@ -506,7 +508,7 @@ class TestUpgrades(BaseTestSuite): instance = TroveInitialDeployment(branch, vm_name) instance.create_config() instance.run_build() - instance.run_deploy() + instance.run_deploy(autostart=True) cliapp.runcmd(['ssh-add', instance.admin_id]) @@ -561,15 +563,7 @@ class TestUpgrades(BaseTestSuite): upgrade.create_config(instance, upgrade_method='ssh-rsync', version_label='trove-current') upgrade.run_build() - upgrade.run_deploy() - - # FIXME: AUTOSTART=yes should do this - try: - 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 + upgrade.run_deploy(autostart=True) self.wait_for_machine_to_boot(instance) @@ -580,7 +574,8 @@ class TestUpgrades(BaseTestSuite): ['snapshot-mgr', 'set-default', 'factory']) remote_runcmd(test_url, ['reboot']) except cliapp.AppException: - # Same hack as above. + # Bit of a hack because we get disconnect before the command + # exits so SSH returns failure. pass self.wait_for_machine_to_boot(instance) -- cgit v1.2.1