[Erp5-report] r41040 luke - in /erp5/trunk/utils/erp5.appliance.test: ./ src/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Dec 2 16:48:15 CET 2010
Author: luke
Date: Thu Dec 2 16:48:15 2010
New Revision: 41040
URL: http://svn.erp5.org?rev=41040&view=rev
Log:
- switch to 2.0, when only extends based scenario (official one) is tested
- do not use svn to detect revision, it can be fetched from url
- use internally provided svn when svn command is needed
- remove old entry points
Modified:
erp5/trunk/utils/erp5.appliance.test/CHANGES.txt
erp5/trunk/utils/erp5.appliance.test/setup.py
erp5/trunk/utils/erp5.appliance.test/src/test.py
Modified: erp5/trunk/utils/erp5.appliance.test/CHANGES.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.appliance.test/CHANGES.txt?rev=41040&r1=41039&r2=41040&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.appliance.test/CHANGES.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.appliance.test/CHANGES.txt [utf8] Thu Dec 2 16:48:15 2010
@@ -1,10 +1,14 @@
-1.18 (unreleased)
------------------
+2.0 (unreleased)
+----------------
+
+ - test only extends based scenrio (official one), as checkout one is easier
+ and will work [Łukasz Nowak]
+ - detect revision without calling extenal svn command
1.17 (2010-12-02)
-----------------
- - bugfix: avoid timeout leakage in case of failed invocation
+ - bugfix: avoid timeout leakage in case of failed invocation [Łukasz Nowak]
1.16 (2010-12-02)
-----------------
Modified: erp5/trunk/utils/erp5.appliance.test/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.appliance.test/setup.py?rev=41040&r1=41039&r2=41040&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.appliance.test/setup.py [utf8] (original)
+++ erp5/trunk/utils/erp5.appliance.test/setup.py [utf8] Thu Dec 2 16:48:15 2010
@@ -1,7 +1,7 @@
from setuptools import setup
name = "erp5.appliance.test"
-version = '1.18'
+version = '2.0'
def r(n): return open(n).read()
@@ -36,8 +36,6 @@ setup(
entry_points="""
[console_scripts]
erp5apptest212 = test:main212
- erp5apptest212ex = test:mainex212
erp5apptest28 = test:main28
- erp5apptest28ex = test:mainex28
""",
)
Modified: erp5/trunk/utils/erp5.appliance.test/src/test.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.appliance.test/src/test.py?rev=41040&r1=41039&r2=41040&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.appliance.test/src/test.py [utf8] (original)
+++ erp5/trunk/utils/erp5.appliance.test/src/test.py [utf8] Thu Dec 2 16:48:15 2010
@@ -285,12 +285,16 @@ class SubFailed(Exception):
class TimeoutException(Exception):
pass
+software_buildout = """
+[buildout]
+extends = https://svn.erp5.org/repos/public/erp5/trunk/buildout/buildout-2.12.cfg
+extends-cache = extends-cache"""
instance_buildout_first_run = """[buildout]
-extends-cache = instance-profiles/extends-cache
+extends-cache = %(extends_cache)s
extends =
- profiles/%s
- instance-profiles/software-home.inc
+ %(instance_profile_url)s
+ %(instance_template_file)s
parts =
mysql-instance
@@ -302,24 +306,16 @@ instance_buildout_complete = instance_bu
runUnitTest"""
-def detectRevision(config, path):
- revision_command = ['svn', 'info', '--non-interactive',
- '--trust-server-cert', path]
- config.logger.info('Checking revision: %r\n' % revision_command)
- revision_popen = subprocess.Popen(revision_command,
- env={'LC_MESSAGES': 'C', 'PATH': os.environ['PATH']},
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- std, err = revision_popen.communicate()
- if revision_popen.returncode != 0:
- config.logger.error('Revision checking failed!: %r\n' % revision_command)
- err = err[:-1]
- config.logger.error("%s", err)
- raise SubFailed
- for line in std.split('\n'):
- if 'Last Changed Rev' in line:
- strumpf, revision = line.split(':')
- return int(revision.strip(' '))
-
+def detectRevision(config, url):
+ revision = 'UNKNOWN'
+ etag = urllib.urlopen(url).headers.get('etag')
+ if etag is not None:
+ etag = etag.strip("'\"")
+ try:
+ revision = etag.split('/')[0]
+ except IndexError:
+ pass
+ return revision
def callWithTimeout(command_list, config, timeout=60, cwd=None,
input_list=None):
@@ -370,41 +366,36 @@ def callWithTimeout(command_list, config
def run_once(config, software_path,
instance_path,
- buildout_file_name,
- development_file_name,
+ software_profile_url,
+ instance_profile_url,
binary_bootstrap_file_name,
suite_name,
previous_software_revision=-1):
status = False
begin = time.time()
- # Checkout/update public buildout repository
- if os.path.isdir(software_path):
- checkout_command = [
- 'svn', 'up', '--non-interactive', '--trust-server-cert',
- software_path]
- else:
- checkout_command = [
- 'svn', 'co', '--non-interactive', '--trust-server-cert',
- 'https://svn.erp5.org/repos/public/erp5/trunk/buildout/',
- software_path]
- callWithTimeout(checkout_command, config)
-
- # Do not continue if unneeded
- revision = detectRevision(config, software_path)
- if revision == previous_software_revision:
- return
+
# Configure ERP5 test reporting handler
+ revision = detectRevision(config, software_profile_url)
erp5_handler = None
if config.erp5_log is not None:
config.logger.debug('Configuring external logging system.')
erp5_handler = ERP5TestReportHandler(config.erp5_log,
getMachineIdString(config), suite_name)
- config.logger.addHandler(erp5_handler)
erp5_handler.revision = revision
+ config.logger.addHandler(erp5_handler)
exc_info = None
+
+ if not os.path.isdir(software_path):
+ os.mkdir(software_path)
+ extends_cache = os.path.join(software_path, 'extends-cache')
+ if not os.path.isdir(extends_cache):
+ os.mkdir(extends_cache)
try:
try:
+ # Create buildout.cfg profile
+ file(os.path.join(software_path, 'buildout.cfg'), 'w').write(
+ software_buildout)
# Download bootstrap file
download_command = ["""python -S -c "import urllib2;f=open("""
"""'bootstrap.py','w');f.write(urllib2.urlopen('http://svn.zope.org"""
@@ -412,19 +403,22 @@ def run_once(config, software_path,
callWithTimeout(download_command, config, cwd=software_path)
# Bootstrap buildout
- bootstrap_command = [config.python, '-S', 'bootstrap.py',
- '-c', buildout_file_name]
+ bootstrap_command = [config.python, '-S', 'bootstrap.py']
callWithTimeout(bootstrap_command, config, timeout=600, cwd=software_path)
# Install software
buildout_command = ['%s/bin/buildout' % software_path]
if config.verbose is True:
buildout_command.append('-v')
- buildout_command.extend(['-c', buildout_file_name])
callWithTimeout(buildout_command, config, timeout=config.buildout_timeout, cwd=software_path)
+ svn = os.path.join(software_path, 'parts', 'subversion', 'bin', 'svn')
# Assert software
- assert_command = [config.python, 'tests/assertSoftware.py']
+ callWithTimeout([svn, 'export', '--non-interactive',
+ '--trust-server-cert',
+ 'https://svn.erp5.org/repos/public/erp5/trunk/buildout/tests/assertSoftware.py'],
+ config, timeout=600, cwd=software_path)
+ assert_command = [config.python, 'assertSoftware.py']
callWithTimeout(assert_command, config, timeout=1800, cwd=software_path)
##############################################
@@ -435,20 +429,14 @@ def run_once(config, software_path,
mkdir = ['mkdir', instance_path]
callWithTimeout(mkdir, config)
- # Links
- link_command = ['ln', '-s']
- for link_path, destination_path in [
- (os.path.join(software_path, 'instance-profiles'), 'instance-profiles'),
- (os.path.join(software_path, 'profiles'), 'profiles'),
- (os.path.join(software_path, 'software-profiles'), 'software-profiles')]:
- if not os.path.exists(os.path.join(instance_path, destination_path)):
- callWithTimeout(link_command + [link_path],
- config, cwd=instance_path)
-
# Create buildout profile
-
+ instance_kw = dict(
+ instance_profile_url = instance_profile_url,
+ extends_cache = extends_cache,
+ instance_template_file = os.path.join(software_path, 'instance.inc')
+ )
file(os.path.join(instance_path, 'buildout.cfg'), 'w').write(
- instance_buildout_first_run % development_file_name)
+ instance_buildout_first_run % instance_kw)
# Bootstrap instance
instance_bootstrap = [os.path.join(software_path, 'bin',
@@ -488,7 +476,7 @@ def run_once(config, software_path,
("mysql> ", "exit")])
# Update profile
file(os.path.join(instance_path, 'buildout.cfg'), 'w').write(
- instance_buildout_complete)
+ instance_buildout_complete % instance_kw)
# Re run buildout
callWithTimeout(instance_buildout, config, timeout=600, cwd=instance_path)
# Run a test from readme
@@ -503,7 +491,7 @@ def run_once(config, software_path,
# Get needed business template
for bt5 in ['erp5_base', 'erp5_ingestion', 'erp5_ingestion_mysql_'
'innodb_catalog', 'erp5_web', 'erp5_dms']:
- callWithTimeout(['svn', 'export', '--non-interactive',
+ callWithTimeout([svn, 'export', '--non-interactive',
'--trust-server-cert',
'https://svn.erp5.org/repos/public/erp5/trunk/bt5/' + bt5,
os.path.join(bt5_directory, bt5)], config, timeout=600)
@@ -554,13 +542,13 @@ def run_once(config, software_path,
def run(config, method,
- buildout_file_name,
- development_file_name,
+ software_profile_url,
+ instance_profile_url,
binary_bootstrap_file_name, suite_name):
software_path = os.path.abspath(os.path.join(config.run_directory_path,
- 'software_checkout'))
+ 'software'))
instance_path = os.path.abspath(os.path.join(config.run_directory_path,
- 'instances'))
+ 'instance'))
sleep_period = 600
# Define loglevel
@@ -590,8 +578,8 @@ def run(config, method,
while 1:
# Run buildout once
- method(config, software_path, instance_path, buildout_file_name,
- development_file_name, binary_bootstrap_file_name,
+ method(config, software_path, instance_path, software_profile_url,
+ instance_profile_url, binary_bootstrap_file_name,
suite_name)
# Clean directory
if not config.update:
@@ -704,10 +692,12 @@ def parserConfig():
def main212():
- """Test ERP5 Appliance for 2.12 with full checkout."""
+ """Test ERP5 Appliance for 2.12."""
try:
config = parserConfig()
- run(config, run_once, 'buildout-2.12.cfg', 'development-2.12.cfg',
+ run(config, run_once,
+ 'https://svn.erp5.org/repos/public/erp5/trunk/buildout/buildout-2.12.cfg',
+ 'https://svn.erp5.org/repos/public/erp5/trunk/buildout/profiles/development-2.12.cfg',
'bootstrap2.6', 'ERP5Appliance212')
return_code = 0
except SystemExit, err:
@@ -717,16 +707,14 @@ def main212():
sys.exit(return_code)
-def mainex212():
- """Test ERP5 Appliance for 2.12 with buildout extends."""
- raise NotImplementedError
-
-
def main28():
- """Test ERP5 Appliance for 2.8 with full checkout."""
+ """Test ERP5 Appliance 2.8."""
try:
config = parserConfig()
- run(config, run_once, 'buildout.cfg', 'development.cfg', 'bootstrap2.4',
+ run(config, run_once,
+ 'https://svn.erp5.org/repos/public/erp5/trunk/buildout/buildout.cfg',
+ 'https://svn.erp5.org/repos/public/erp5/trunk/buildout/profiles/development.cfg',
+ 'bootstrap2.4',
'ERP5Appliance28')
return_code = 0
except SystemExit, err:
@@ -734,8 +722,3 @@ def main28():
return_code = err
sys.exit(return_code)
-
-
-def mainex28():
- """Test ERP5 Appliance for 2.8 with buildout extends."""
- raise NotImplementedError
More information about the Erp5-report
mailing list