mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Clean up integration testing
This commit is contained in:
parent
03a48b9407
commit
86afbaf929
7 changed files with 54 additions and 27 deletions
3
build_settings.yml
Normal file
3
build_settings.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
virtualbox:
|
||||
guest_additions: /root/images/VBoxGuestAdditions.iso
|
|
@ -1,11 +1,4 @@
|
|||
import os.path
|
||||
from bootstrapvz.common.tools import load_data
|
||||
|
||||
partial_manifests_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'manifests')
|
||||
import glob
|
||||
partial_yaml = glob.glob(os.path.join(partial_manifests_path, '*.yml'))
|
||||
partial_json = glob.glob(os.path.join(partial_manifests_path, '*.json'))
|
||||
manifests = {}
|
||||
for path in partial_yaml + partial_json:
|
||||
manifests[os.path.basename(path)] = load_data(path)
|
||||
build_settings = load_data(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'build_settings.yml'))
|
||||
# tox makes sure that the cwd is the project root
|
||||
build_settings = load_data('build_settings.yml')
|
||||
|
|
15
tests/integration/manifests/__init__.py
Normal file
15
tests/integration/manifests/__init__.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import os.path
|
||||
import glob
|
||||
from bootstrapvz.common.tools import load_data
|
||||
|
||||
partial_json = glob.glob(os.path.join(os.path.dirname(__file__), '*.yml'))
|
||||
partial_yaml = glob.glob(os.path.join(os.path.dirname(__file__), '*.json'))
|
||||
|
||||
def dictkey(path):
|
||||
return
|
||||
# yaml overrides json
|
||||
partials = {}
|
||||
for path in partial_json + partial_yaml:
|
||||
key = os.path.splitext(os.path.basename(path))[0]
|
||||
partials[key] = load_data(path)
|
||||
|
4
tests/integration/manifests/stable64.yml
Normal file
4
tests/integration/manifests/stable64.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
system:
|
||||
release: wheezy
|
||||
architecture: amd64
|
|
@ -1,4 +1,6 @@
|
|||
from bootstrapvz.common.tools import load_data
|
||||
|
||||
build_servers = load_data('build_servers.yml')
|
||||
|
||||
# Snatched from here: http://stackoverflow.com/a/7205107
|
||||
def merge_dicts(*args):
|
||||
|
@ -19,11 +21,20 @@ def merge_dicts(*args):
|
|||
return reduce(merge, args, {})
|
||||
|
||||
|
||||
def bootstrap(manifest, build_settings):
|
||||
def bootstrap(manifest):
|
||||
# if 'build_host' in build_settings:
|
||||
# run = get_remote_run(build_settings)
|
||||
# else:
|
||||
# run = __import__('bootstrapvz.base.run')
|
||||
# run(manifest)
|
||||
from bootstrapvz.base.remote.remote import run
|
||||
run(manifest,
|
||||
build_servers['virtualbox'],
|
||||
debug=True,
|
||||
dry_run=True)
|
||||
|
||||
from ..image import Image
|
||||
return Image()
|
||||
|
||||
def test_instance(instance):
|
||||
pass
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
import tools
|
||||
from . import manifests
|
||||
from manifests import partials
|
||||
from . import build_settings
|
||||
|
||||
|
||||
def test_virtualbox_unpartitioned_extlinux():
|
||||
specific_settings = {}
|
||||
specific_settings['provider'] = {'name': 'virtualbox',
|
||||
'guest_additions': build_settings['virtualbox']['guest_additions']}
|
||||
specific_settings['system'] = {'release': 'wheezy',
|
||||
'architecture': 'amd64',
|
||||
'bootloader': 'extlinux'}
|
||||
specific_settings['volume'] = {'backing': 'vdi',
|
||||
'partitions': {'type': 'msdos'}}
|
||||
manifest = tools.merge_dicts(manifests['base'], manifests['unpartitioned'], specific_settings)
|
||||
import yaml
|
||||
specific_settings = yaml.load("""
|
||||
provider:
|
||||
name: virtualbox
|
||||
guest_additions: {guest_additions}
|
||||
system:
|
||||
bootloader: extlinux
|
||||
volume:
|
||||
backing: vdi
|
||||
partitions:
|
||||
type: msdos
|
||||
""".format(guest_additions=build_settings['virtualbox']['guest_additions']))
|
||||
manifest = tools.merge_dicts(partials['base'], partials['stable64'],
|
||||
partials['unpartitioned'], specific_settings)
|
||||
|
||||
client = tools.get_client(build_settings['virtualbox'])
|
||||
|
||||
image = client.bootstrap(manifest, build_settings['virtualbox'])
|
||||
image = tools.bootstrap(manifest)
|
||||
instance = image.create_instance()
|
||||
instance.boot()
|
||||
|
||||
tools.test_instance(instance, build_settings['virtualbox'])
|
||||
tools.test_instance(instance)
|
||||
|
||||
instance.destroy()
|
||||
image.destroy()
|
||||
|
||||
client.shutdown()
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -3,7 +3,7 @@ ignore = E101,E221,E241,E501,W191
|
|||
max-line-length = 110
|
||||
|
||||
[tox]
|
||||
envlist = flake8, integration
|
||||
envlist = flake8, unit
|
||||
|
||||
[testenv:flake8]
|
||||
deps = flake8
|
||||
|
|
Loading…
Add table
Reference in a new issue