summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-03-11 15:04:21 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-03-11 15:04:21 +0000
commit4fbdab363b301c24933601746766afa4b9c4435e (patch)
tree889edc86d0b9fb0c297d2e409ac9928c35d2a8b8
parent6e75813a8938f7e27c5a9d779f0c1c325a556650 (diff)
downloadsystem-tests-4fbdab363b301c24933601746766afa4b9c4435e.tar.gz
A few fixes
-rw-r--r--config.py10
-rw-r--r--test_trove_upgrades.py34
-rw-r--r--util.py19
3 files changed, 40 insertions, 23 deletions
diff --git a/config.py b/config.py
index 4ccc8f2..3e6e0aa 100644
--- a/config.py
+++ b/config.py
@@ -35,14 +35,18 @@ BOOT_TIMEOUT=20
# branch, really ... but for now, if the installed Morph can't build
# baserock:baserock/morphs 'master' branch, you can change this!
os.environ['PYTHONPATH'] = '/src/morph'
-#MORPH_COMMAND = ['/src/morph/morph', '--no-git-update']
-MORPH_COMMAND = '/src/morph/morph'
+MORPH_COMMAND = ['/src/morph/morph', '--no-git-update']
+#MORPH_COMMAND = '/src/morph/morph'
#MORPH_COMMAND = 'morph'
BUILD_TEMPDIR = '/src/tmp'
-BRANCH = 'master'
+#BRANCH = 'master'
+BRANCH = 'baserock/sam/trove-configure'
# For debugging. FIXME: would be better if cliapp's logging mechanism supported
# logging to stdout, but .... :(
VERBOSE = True
+
+# Set by the test runner after initialising the fixture directory.
+log_dir = None
diff --git a/test_trove_upgrades.py b/test_trove_upgrades.py
index 8f39aec..596f000 100644
--- a/test_trove_upgrades.py
+++ b/test_trove_upgrades.py
@@ -63,7 +63,6 @@ import yaml
# functions in morphlib to do stuff. It's better than copying and pasting
# stuff though!
import morphlib
-import morphlib.plugins.branch_and_merge_plugin
import config
import util
@@ -239,11 +238,6 @@ class TroveUpgrade(Deployment):
super(TroveUpgrade, self).__init__(
'trove-system-x86_64', 'trove-test-upgrade', systembranch)
- # Temporary hack until Pedro's branch is merged.
- systembranch.set_chunk_version(
- 'trove-system-x86_64', 'foundation', 'tbdiff',
- ref='origin/baserock/pedroalvarez/system-version-manager4')
-
def run_deploy(self, autostart=False):
autostart_param = \
'%s.AUTOSTART=%s' % (self.name, 'yes' if autostart else 'no')
@@ -311,13 +305,15 @@ class TroveUpgrade(Deployment):
write_file(deploy_morph_file, yaml.dump(deploy_morph))
-class SystemTestBranch(object):
+class SystemTestBranch():
'''Morph system-branch abstraction for use in Baserock system tests.'''
def __init__(self, workspace_dir, name):
self.workspace_dir = workspace_dir
self.branch_dir = os.path.join(workspace_dir, name)
self.morphs_dir = os.path.join(
- self.branch_dir, 'baserock:baserock', 'definitions')
+ self.branch_dir, 'baserock', 'baserock', 'definitions')
+
+ self.sysbranch = morphlib.sysbranchdir.open(self.branch_dir)
def get_repo_and_ref_for_chunk(self, stratum, chunk):
stratum_morph_file = os.path.join(
@@ -354,7 +350,7 @@ class SystemTestBranch(object):
Uses `morph edit` and `git reset` to achieve this.
'''
- chunk_repo_uri, original_ref = self.get_repo_and_ref_for_chunk(
+ chunk_repo_url, original_ref = self.get_repo_and_ref_for_chunk(
stratum, chunk)
with set_directory(self.morphs_dir):
@@ -362,9 +358,7 @@ class SystemTestBranch(object):
run_git(['add', '%s.morph' % stratum])
run_git(['commit', '-m', 'Edit %s chunk' % chunk])
- plugin = morphlib.plugins.branch_and_merge_plugin.BranchAndMergePlugin
- chunk_dir = os.path.join(
- self.branch_dir, plugin.convert_uri_to_path(chunk_repo_uri))
+ chunk_dir = self.sysbranch.get_git_directory_name(chunk_repo_url)
run_git(['reset', '--hard', ref], cwd=chunk_dir)
self._copy_chunk_morph_if_missing(chunk_dir, chunk, original_ref)
@@ -721,11 +715,11 @@ class TestUpgrades(BaseTestSuite):
with self.given_out_of_date_trove_instance(
fixture_dir, reuse=reuse_fixture) as instance:
# Set up Bob's account without a password.
- #instance.runcmd(['adduser', '-D', 'bob'])
- #whoami = instance.runcmd(['su', 'bob', '-c', 'whoami'])
- #home = instance.runcmd(['su', 'bob', '-c', '\"cd && pwd\"'])
- #assert whoami == "bob\n"
- #assert home == "/home/bob\n"
+ instance.runcmd(['adduser', '-D', 'bob'])
+ whoami = instance.runcmd(['su', 'bob', '-c', 'whoami'])
+ home = instance.runcmd(['su', 'bob', '-c', '\"cd && pwd\"'])
+ assert whoami == "bob\n"
+ assert home == "/home/bob\n"
self.upgrade_to_latest_trove(workspace_dir, instance)
@@ -809,7 +803,11 @@ class SimpleTestRunner(cliapp.Application):
else:
fixture_dir = cliapp.runcmd(
['mktemp', '-d', '-p', config.BUILD_TEMPDIR]).strip()
- run_morph(['init', fixture_dir])
+ run_morph(['init', fixture_dir])
+
+ # `morph init` expects the workspace dir to be empty, but once it's
+ # created we can put the logs in there too. Why not.
+ config.log_dir = fixture_dir
try:
print "Running %s" % test
diff --git a/util.py b/util.py
index 15c9c72..390e04c 100644
--- a/util.py
+++ b/util.py
@@ -25,11 +25,26 @@ import config
def run_morph(args, **kwargs):
- '''Run Morph on the current machine.'''
+ '''Run Morph on the current machine.
+
+ This is not quite compatible with the run_morph() shell function inside
+ Morph's Yarn's because these tests require connectivity to an actual Trove
+ and an actual VM host and therefore it's quite a different setup to the
+ self-contained Morph test suite.
+
+ '''
morph_command = config.MORPH_COMMAND
if isinstance(morph_command, str):
- morph_command = morph_command.split(' ')
+ if ' ' in morph_command:
+ morph_command = morph_command.split(' ')
+ else:
+ morph_command = [morph_command]
+
+ if config.log_dir is not None:
+ morph_command += ['--log', os.path.join(config.log_dir, 'morph.log')]
+
cmd = morph_command + args
+
if config.VERBOSE:
print ' '.join(cmd)
if 'stdout' not in kwargs: