Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E43FD920B for ; Mon, 21 May 2012 18:09:21 +0000 (UTC) Received: (qmail 19700 invoked by uid 500); 21 May 2012 18:09:21 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 19683 invoked by uid 500); 21 May 2012 18:09:21 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 19674 invoked by uid 99); 21 May 2012 18:09:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2012 18:09:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2012 18:09:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 34F1B2388978 for ; Mon, 21 May 2012 18:09:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1341134 - /accumulo/branches/1.4/test/system/auto/TestUtils.py Date: Mon, 21 May 2012 18:09:00 -0000 To: commits@accumulo.apache.org From: vines@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120521180900.34F1B2388978@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vines Date: Mon May 21 18:08:59 2012 New Revision: 1341134 URL: http://svn.apache.org/viewvc?rev=1341134&view=rev Log: ACCUMULO-337 - fixes functional test Modified: accumulo/branches/1.4/test/system/auto/TestUtils.py Modified: accumulo/branches/1.4/test/system/auto/TestUtils.py URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/test/system/auto/TestUtils.py?rev=1341134&r1=1341133&r2=1341134&view=diff ============================================================================== --- accumulo/branches/1.4/test/system/auto/TestUtils.py (original) +++ accumulo/branches/1.4/test/system/auto/TestUtils.py Mon May 21 18:08:59 2012 @@ -24,7 +24,7 @@ import socket import signal import select import random - +import shutil import sleep # mapreduce sets SIGHUP to ignore, which we use to stop child processes @@ -45,7 +45,10 @@ ACCUMULO_DIR = "/user/" + os.getlogin() SITE = "test-" + ID WALOG = os.path.join(ACCUMULO_HOME, 'walogs', ID) -General_CLASSPATH = "$ACCUMULO_HOME/lib/[^.].$ACCUMULO_VERSION.jar, $ACCUMULO_HOME/lib/[^.].*.jar, $ZOOKEEPER_HOME/zookeeper[^.].*.jar, $HADOOP_HOME/conf,$HADOOP_HOME/[^.].*.jar, $HADOOP_HOME/lib/[^.].*.jar" +LOG_PROPERTIES= os.path.join(ACCUMULO_HOME, 'conf', 'log4j.properties') +LOG_GENERIC = os.path.join(ACCUMULO_HOME, 'conf', 'generic_logger.xml') +General_CLASSPATH = ("$ACCUMULO_HOME/lib/[^.].$ACCUMULO_VERSION.jar, $ACCUMULO_HOME/lib/[^.].*.jar, $ZOOKEEPER_HOME/zookeeper[^.].*.jar," +"$HADOOP_HOME/conf,$HADOOP_HOME/[^.].*.jar, $HADOOP_HOME/lib/[^.].*.jar") log = logging.getLogger('test.auto') @@ -79,8 +82,8 @@ class TestUtilsMixin: settings = {'tserver.port.search': 'true', 'tserver.memory.maps.max':'100M', - 'tserver.cache.data.size':'10M', - 'tserver.cache.index.size':'20M', + 'tserver.cache.data.size':'10M', + 'tserver.cache.index.size':'20M', 'instance.zookeeper.timeout': '10s', 'gc.cycle.delay': '1s', 'gc.cycle.start': '1s', @@ -95,13 +98,13 @@ class TestUtilsMixin: log.debug('%s: %s', host, ' '.join(cmd)) if host == 'localhost': os.environ['ACCUMULO_TSERVER_OPTS']='-Xmx700m ' - os.environ['ACCUMULO_GENERAL_OPTS']='-Dorg.apache.accumulo.config.file=%s ' % SITE + os.environ['ACCUMULO_GENERAL_OPTS']=('-Dorg.apache.accumulo.config.file=%s' % (SITE)) os.environ['ACCUMULO_LOG_DIR']= ACCUMULO_HOME + '/logs/' + ID return Popen(cmd, stdout=PIPE, stderr=PIPE, **opts) else: cp = 'HADOOP_CLASSPATH=%s' % os.environ.get('HADOOP_CLASSPATH','') jo = "ACCUMULO_TSERVER_OPTS='-Xmx700m '" - go = "ACCUMULO_GENERAL_OPTS='-Dorg.apache.accumulo.config.file=%s'" % SITE + go = ("ACCUMULO_GENERAL_OPTS='-Dorg.apache.accumulo.config.file=%s'" % (SITE)) ld = 'ACCUMULO_LOG_DIR=%s/logs/%s' % (ACCUMULO_HOME, ID) execcmd = ['ssh', '-q', host, cp, jo, go, ld] + quote(cmd) log.debug(repr(execcmd)) @@ -238,16 +241,16 @@ class TestUtilsMixin: 'w') fp.write('\n') settings = self.settings.copy() - settings.update({'instance.zookeeper.host': ZOOKEEPERS, - 'instance.dfs.dir': ACCUMULO_DIR, - 'tserver.port.client': 39000 + FUZZ, - 'master.port.client': 41000 + FUZZ, - 'monitor.port.client': 50099, - 'logger.port.client': 44000 + FUZZ, - 'gc.port.client': 45000 + FUZZ, - 'logger.dir.walog': WALOG, - 'general.classpaths' :General_CLASSPATH, - 'instance.secret': 'secret', + settings.update({ 'instance.zookeeper.host': ZOOKEEPERS, + 'instance.dfs.dir': ACCUMULO_DIR, + 'tserver.port.client': 39000 + FUZZ, + 'master.port.client': 41000 + FUZZ, + 'monitor.port.client': 50099, + 'logger.port.client': 44000 + FUZZ, + 'gc.port.client': 45000 + FUZZ, + 'logger.dir.walog': WALOG, + 'general.classpaths' :General_CLASSPATH, + 'instance.secret': 'secret', }) for a, v in settings.items(): fp.write(' \n') @@ -273,6 +276,16 @@ class TestUtilsMixin: out, err = handle.communicate(INSTANCE_NAME+"\n"+ROOT_PASSWORD + "\n" + ROOT_PASSWORD+"\n") self.processResult(out, err, handle.returncode) + def setup_logging(self): + if os.path.exists(LOG_PROPERTIES): + os.rename(LOG_PROPERTIES, '%s.bkp' % LOG_PROPERTIES) + if os.path.exists(LOG_GENERIC): + os.rename(LOG_GENERIC, '%s.bkp' % LOG_GENERIC) + + shutil.copyfile('%s/conf/examples/512MB/standalone/log4j.properties' % ACCUMULO_HOME, LOG_PROPERTIES) + shutil.copyfile('%s/conf/examples/512MB/standalone/generic_logger.xml' % ACCUMULO_HOME, LOG_GENERIC) + + def start_accumulo_procs(self, safeMode=None): self.accumuloHandles = [ self.start_logger(host) for host in self.hosts @@ -380,6 +393,16 @@ class TestUtilsMixin: for h in self.accumuloHandles: self.waitForStop(h, 60) + def clean_logging(self): + LOG_PROPERTIES_BACKUP='%s.bkp' % LOG_PROPERTIES + LOG_GENERIC_BACKUP='%s.bkp' % LOG_GENERIC + os.remove(LOG_PROPERTIES) + os.remove(LOG_GENERIC) + if os.path.exists(LOG_PROPERTIES_BACKUP): + os.rename(LOG_PROPERTIES_BACKUP, LOG_PROPERTIES) + if os.path.exists(LOG_GENERIC_BACKUP): + os.rename(LOG_GENERIC_BACKUP, LOG_GENERIC) + def sleep(self, secs): log.debug("Sleeping %f seconds" % secs) sleep.sleep(secs) @@ -387,19 +410,21 @@ class TestUtilsMixin: def setUp(self): self.hosts = self.options.hosts self.clean_accumulo(self.masterHost()) + self.setup_logging() self.start_accumulo() def tearDown(self): if self.options.clean: - self.stop_accumulo() - self.wait(self.runOn(self.masterHost(), - ['hadoop', 'fs', '-rmr', ACCUMULO_DIR])) - self.wait(self.runClassOn(self.masterHost(), - 'org.apache.accumulo.server.util.DeleteZooInstance', - [INSTANCE_NAME])) - self.wait(self.runOn(self.masterHost(), ['rm', '-rf', WALOG])) - self.wait(self.runOn(self.masterHost(), ['rm', '-rf', ACCUMULO_HOME + '/logs/' + ID])) - os.unlink(os.path.join(ACCUMULO_HOME, 'conf', SITE)) + self.stop_accumulo() + self.wait(self.runOn(self.masterHost(), + ['hadoop', 'fs', '-rmr', ACCUMULO_DIR])) + self.wait(self.runClassOn(self.masterHost(), + 'org.apache.accumulo.server.util.DeleteZooInstance', + [INSTANCE_NAME])) + self.wait(self.runOn(self.masterHost(), ['rm', '-rf', WALOG])) + self.wait(self.runOn(self.masterHost(), ['rm', '-rf', ACCUMULO_HOME + '/logs/' + ID])) + self.clean_logging() + os.unlink(os.path.join(ACCUMULO_HOME, 'conf', SITE)) def createTable(self, table, splitFile=None): if splitFile :