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
|
from bootstrapvz.common.tools import load_data
|
||||||
|
|
||||||
partial_manifests_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'manifests')
|
# tox makes sure that the cwd is the project root
|
||||||
import glob
|
build_settings = load_data('build_settings.yml')
|
||||||
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'))
|
|
||||||
|
|
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
|
# Snatched from here: http://stackoverflow.com/a/7205107
|
||||||
def merge_dicts(*args):
|
def merge_dicts(*args):
|
||||||
|
@ -19,11 +21,20 @@ def merge_dicts(*args):
|
||||||
return reduce(merge, args, {})
|
return reduce(merge, args, {})
|
||||||
|
|
||||||
|
|
||||||
def bootstrap(manifest, build_settings):
|
def bootstrap(manifest):
|
||||||
# if 'build_host' in build_settings:
|
# if 'build_host' in build_settings:
|
||||||
# run = get_remote_run(build_settings)
|
# run = get_remote_run(build_settings)
|
||||||
# else:
|
# else:
|
||||||
# run = __import__('bootstrapvz.base.run')
|
# run = __import__('bootstrapvz.base.run')
|
||||||
# run(manifest)
|
# run(manifest)
|
||||||
|
from bootstrapvz.base.remote.remote import run
|
||||||
|
run(manifest,
|
||||||
|
build_servers['virtualbox'],
|
||||||
|
debug=True,
|
||||||
|
dry_run=True)
|
||||||
|
|
||||||
from ..image import Image
|
from ..image import Image
|
||||||
return Image()
|
return Image()
|
||||||
|
|
||||||
|
def test_instance(instance):
|
||||||
|
pass
|
||||||
|
|
|
@ -1,28 +1,29 @@
|
||||||
import tools
|
import tools
|
||||||
from . import manifests
|
from manifests import partials
|
||||||
from . import build_settings
|
from . import build_settings
|
||||||
|
|
||||||
|
|
||||||
def test_virtualbox_unpartitioned_extlinux():
|
def test_virtualbox_unpartitioned_extlinux():
|
||||||
specific_settings = {}
|
import yaml
|
||||||
specific_settings['provider'] = {'name': 'virtualbox',
|
specific_settings = yaml.load("""
|
||||||
'guest_additions': build_settings['virtualbox']['guest_additions']}
|
provider:
|
||||||
specific_settings['system'] = {'release': 'wheezy',
|
name: virtualbox
|
||||||
'architecture': 'amd64',
|
guest_additions: {guest_additions}
|
||||||
'bootloader': 'extlinux'}
|
system:
|
||||||
specific_settings['volume'] = {'backing': 'vdi',
|
bootloader: extlinux
|
||||||
'partitions': {'type': 'msdos'}}
|
volume:
|
||||||
manifest = tools.merge_dicts(manifests['base'], manifests['unpartitioned'], specific_settings)
|
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 = tools.bootstrap(manifest)
|
||||||
|
|
||||||
image = client.bootstrap(manifest, build_settings['virtualbox'])
|
|
||||||
instance = image.create_instance()
|
instance = image.create_instance()
|
||||||
instance.boot()
|
instance.boot()
|
||||||
|
|
||||||
tools.test_instance(instance, build_settings['virtualbox'])
|
tools.test_instance(instance)
|
||||||
|
|
||||||
instance.destroy()
|
instance.destroy()
|
||||||
image.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
|
max-line-length = 110
|
||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
envlist = flake8, integration
|
envlist = flake8, unit
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
deps = flake8
|
deps = flake8
|
||||||
|
|
Loading…
Add table
Reference in a new issue