コード例 #1
0
 def __init__(self, logname, nanocount=10
 ,       cmaimage='assimilation/build-utopic', nanoimages=('assimilation/build-utopic',)
 ,       sysclass=DockerSystem, cleanupwhendone=True, nanodebug=0, cmadebug=0, chunksize=20):
     'Init/constructor for our SystemTestEnvironment'
     self.sysclass = sysclass
     self.cmaimage = cmaimage
     self.nanoimages = nanoimages
     self.nanoprobes = []
     self.cma = None
     self.debug = 0
     self.cleanupwhendone = cleanupwhendone
     self.logname = logname
     watch = LogWatcher(logname, [])
     watch.setwatch()
     nanodebug=1
     cmadebug=0
     self.nanodebug = nanodebug
     self.cmadebug = nanodebug
     self.spawncma(nanodebug=nanodebug, cmadebug=cmadebug)
     regex = (' %s .* INFO: Neo4j version .* // py2neo version .*'
             ' // Python version .* // java version.*') % self.cma.hostname
     watch.setregexes((regex,))
     if watch.lookforall(timeout=60) is None:
         print >> sys.stderr, 'CMA did not start!!'
         raise RuntimeError('CMA did not start')
     print >> sys.stderr, 'nanocount is', nanocount
     print >> sys.stderr, 'self.nanoimages is', self.nanoimages
     # We do this in chunks to manage stress on our test environment
     children_left = range(0, nanocount)
     while (len(children_left) > 0):
         self._create_nano_chunk(children_left[0:chunksize])
         del children_left[0:chunksize]
コード例 #2
0
 def __init__(self, logname, nanocount=10
 ,       cmaimage='assimilation/build-wily', nanoimages=('assimilation/build-wily',)
 #,       cmaimage='3f06b7c84030', nanoimages=('3f06b7c84030',)
 ,       sysclass=DockerSystem, cleanupwhendone=False, nanodebug=0, cmadebug=0, chunksize=20):
     'Init/constructor for our SystemTestEnvironment'
     self.sysclass = sysclass
     self.cmaimage = cmaimage
     self.nanoimages = nanoimages
     self.nanoprobes = []
     self.cma = None
     self.debug = 0
     self.cleanupwhendone = cleanupwhendone
     self.logname = logname
     watch = LogWatcher(logname, [])
     watch.setwatch()
     nanodebug=1
     cmadebug=2
     self.nanodebug = nanodebug
     self.cmadebug = nanodebug
     self.spawncma(nanodebug=nanodebug, cmadebug=cmadebug)
     regex = (' %s .* INFO: Neo4j version .* // py2neo version .*'
             ' // Python version .* // (java|openjdk) version.*') % self.cma.hostname
     watch.setregexes((regex,))
     if watch.lookforall(timeout=120) is None:
         os.system("logger -s 'CMA did not start!! [[%s]]'" % (regex))
         print >> sys.stderr, 'CMA did not start!! %s' % regex
         raise RuntimeError('CMA did not start: %s' % regex)
     print >> sys.stderr, 'nanocount is', nanocount
     print >> sys.stderr, 'self.nanoimages is', self.nanoimages
     # We do this in chunks to manage stress on our test environment
     children_left = range(0, nanocount)
     while (len(children_left) > 0):
         self._create_nano_chunk(children_left[0:chunksize])
         del children_left[0:chunksize]
コード例 #3
0
 def _create_nano_chunk(self, childnos):
     'Create a chunk of nanoprobes'
     watch = LogWatcher(self.logname, [])
     watch.setwatch()
     regexes = []
     for childcount in childnos:
         childcount = childcount # Make pylint happy...
         nano = self.spawnnanoprobe(debug=self.nanodebug)
         regexes .extend([
             r' (%s) nanoprobe\[.*]: NOTICE: Connected to CMA.  Happiness :-D'
             %   (nano.hostname),
             r' %s cma INFO: Drone %s registered from address \[::ffff:%s]'
             %           (self.cma.hostname, nano.hostname, nano.ipaddr),
             r' %s cma INFO: Processed tcpdiscovery JSON data from (%s) into graph.'
             %       (self.cma.hostname, nano.hostname),
         ])
         self.nanoprobes.append(nano)
     watch.setregexes(regexes)
     if watch.lookforall(timeout=30) is None:
         raise RuntimeError('Nanoprobes did not start [%s, %s] - missing %s'
         %   (nano.hostname, nano.ipaddr, str(watch.unmatched)))
コード例 #4
0
 def _create_nano_chunk(self, childnos):
     'Create a chunk of nanoprobes'
     watch = LogWatcher(self.logname, [])
     watch.setwatch()
     regexes = []
     for childcount in childnos:
         childcount = childcount  # Make pylint happy...
         nano = self.spawnnanoprobe(debug=self.nanodebug)
         regexes.extend([
             r' (%s) nanoprobe\[.*]: NOTICE: Connected to CMA.  Happiness :-D'
             % (nano.hostname),
             r' %s cma INFO: Drone %s registered from address \[::ffff:%s]'
             % (self.cma.hostname, nano.hostname, nano.ipaddr),
             r' %s cma INFO: Processed tcpdiscovery JSON data from (%s) into graph.'
             % (self.cma.hostname, nano.hostname),
         ])
         self.nanoprobes.append(nano)
     watch.setregexes(regexes)
     if watch.lookforall(timeout=30) is None:
         raise RuntimeError(
             'Nanoprobes did not start [%s, %s] - missing %s' %
             (nano.hostname, nano.ipaddr, str(watch.unmatched)))
コード例 #5
0
 def _create_nano_chunk(self, childnos):
     'Create a chunk of nanoprobes'
     watch = LogWatcher(self.logname, [], debug=0)
     watch.setwatch()
     regexes = []
     for childcount in childnos:
         childcount = childcount # Make pylint happy...
         nano = self.spawnnanoprobe(debug=self.nanodebug)
         regexes .extend([
             r' %s nanoprobe\[.*]: NOTICE: Connected to CMA.  Happiness :-D'
             %   (nano.hostname),
             r' %s cma INFO: Drone %s registered from address \[::ffff:%s]'
             %           (self.cma.hostname, nano.hostname, nano.ipaddr),
             r' %s cma INFO: Processed u?n?changed tcpdiscovery'
             r' JSON data from %s into graph.'
             %       (self.cma.hostname, nano.hostname),
         ])
         self.nanoprobes.append(nano)
     print >> sys.stderr, len(regexes), 'NANOPROBE REGEXES ARE:', (regexes)
     watch.setregexes(regexes)
     if watch.lookforall(timeout=120) is None:
         raise RuntimeError('Nanoprobes did not start - missing %s'
         %   (str(watch.unmatched)))