options for create_snapshot and for predefined_tar

This commit is contained in:
vic 2013-03-05 22:04:17 +04:00
parent 661345e934
commit f7b833b313
7 changed files with 34 additions and 15 deletions

View File

@ -2,6 +2,8 @@ from fuel_test.cobbler.cobbler_test_case import CobblerTestCase
from fuel_test.helpers import is_not_essex
import unittest
from fuel_test.manifest import Manifest, Template
from fuel_test.settings import CREATE_SNAPSHOTS
class CompactTestCase(CobblerTestCase):
def deploy_compact(self, quantum=True, loopback=True):
@ -25,6 +27,7 @@ class CompactTestCase(CobblerTestCase):
quantums=self.nodes().quantums,
quantum=True)
self.deploy_compact()
if CREATE_SNAPSHOTS:
self.environment().snapshot('compact', force=True)
def test_deploy_compact_wo_quantum(self):
@ -35,6 +38,7 @@ class CompactTestCase(CobblerTestCase):
quantums=self.nodes().quantums,
quantum=False)
self.deploy_compact(quantum=False)
if CREATE_SNAPSHOTS:
self.environment().snapshot('compact_wo_quantum', force=True)
def test_deploy_compact_wo_loopback(self):
@ -45,7 +49,9 @@ class CompactTestCase(CobblerTestCase):
quantums=self.nodes().quantums,
quantum=False, loopback=False, use_syslog=False)
self.deploy_compact(quantum=False, loopback=False)
if CREATE_SNAPSHOTS:
self.environment().snapshot('compact_woloopback', force=True)
if __name__ == '__main__':
unittest.main()

View File

@ -2,6 +2,8 @@ import unittest
from fuel_test.cobbler.cobbler_test_case import CobblerTestCase
from fuel_test.helpers import is_not_essex
from fuel_test.manifest import Manifest, Template
from fuel_test.settings import CREATE_SNAPSHOTS
class FullTestCase(CobblerTestCase):
def test_full(self):
@ -25,8 +27,7 @@ class FullTestCase(CobblerTestCase):
self.validate(self.nodes().proxies, 'puppet agent --test')
Manifest().write_nagios_manifest(remote=self.remote())
self.validate(self.nodes().controllers[:1], 'puppet agent --test')
def snapshot(self):
if CREATE_SNAPSHOTS:
self.environment().snapshot('full', force=True)
if __name__ == '__main__':

View File

@ -2,6 +2,8 @@ import unittest
from fuel_test.cobbler.cobbler_test_case import CobblerTestCase
from fuel_test.helpers import is_not_essex
from fuel_test.manifest import Manifest, Template
from fuel_test.settings import CREATE_SNAPSHOTS
class MinimalTestCase(CobblerTestCase):
def test_minimal(self):
@ -18,6 +20,7 @@ class MinimalTestCase(CobblerTestCase):
if is_not_essex():
self.validate(self.nodes().quantums, 'puppet agent --test')
self.validate(self.nodes().computes, 'puppet agent --test')
if CREATE_SNAPSHOTS:
self.environment().snapshot('minimal', force=True)
if __name__ == '__main__':

View File

@ -1,7 +1,8 @@
import unittest
from fuel_test.cobbler.cobbler_test_case import CobblerTestCase
from fuel_test.manifest import Manifest
from fuel_test.settings import OPENSTACK_SNAPSHOT
from fuel_test.settings import OPENSTACK_SNAPSHOT, CREATE_SNAPSHOTS
class SimpleTestCase(CobblerTestCase):
def test_simple(self):
@ -12,6 +13,7 @@ class SimpleTestCase(CobblerTestCase):
self.validate(
self.nodes().controllers + self.nodes().computes,
'puppet agent --test')
if CREATE_SNAPSHOTS:
self.environment().snapshot(OPENSTACK_SNAPSHOT, force=True)
if __name__ == '__main__':

View File

@ -1,7 +1,8 @@
import unittest
from fuel_test.cobbler.cobbler_test_case import CobblerTestCase
from fuel_test.manifest import Manifest
from fuel_test.settings import OPENSTACK_SNAPSHOT
from fuel_test.settings import OPENSTACK_SNAPSHOT, CREATE_SNAPSHOTS
class SingleTestCase(CobblerTestCase):
def test_single(self):
@ -13,6 +14,7 @@ class SingleTestCase(CobblerTestCase):
self.validate(
self.nodes().controllers,
'puppet agent --test')
if CREATE_SNAPSHOTS:
self.environment().snapshot(OPENSTACK_SNAPSHOT, force=True)
if __name__ == '__main__':

View File

@ -6,7 +6,7 @@ from devops.helpers.helpers import wait
import os
import re
from fuel_test.cobbler.cobbler_client import CobblerClient
from fuel_test.settings import OS_FAMILY, PUPPET_CLIENT_PACKAGE, PUPPET_VERSION, PUPPET_MASTER_SERVICE
from fuel_test.settings import OS_FAMILY, PUPPET_CLIENT_PACKAGE, PUPPET_VERSION, PUPPET_MASTER_SERVICE, EXIST_TAR
from root import root
def get_file_as_string(path):
@ -183,6 +183,9 @@ def upload_recipes(remote, remote_dir="/etc/puppet/modules/"):
recipes_dir = root('deployment', 'puppet')
tar_file = None
try:
if EXIST_TAR:
remote.upload(EXIST_TAR, '/tmp/recipes.tar')
else:
tar_file = remote.open('/tmp/recipes.tar', 'wb')
with tarfile.open(fileobj=tar_file, mode='w') as tar:
tar.add(recipes_dir, arcname='')

View File

@ -98,3 +98,5 @@ POOLS = {
}
TEST_REPO = os.environ.get('TEST_REPO', 'false') == 'true'
EXIST_TAR = os.environ.get('EXIST_TAR', None)
CREATE_SNAPSHOTS = os.environ.get('CREATE_SNAPSHOTS', 'true') == 'true'