Example #1
0
def setTestParameters(hostname, transactions, multithreaded, workspace, rundir, apps, scenarioTypes, recordPMC):
  """
  A method run at the beginning of tests to create and enter a REMOTE environment
  and at the end of tests to exit the REMOTE environment

 @param hostname: An option added to the pytest parser to accept a REMOTE host
                   Defaults to 127.0.0.1
  @type hostname: C{str}
  """
  from xpedite.util              import makeLogPath
  from xpedite.transport.net     import isIpLocal
  from xpedite.transport.remote  import Remote
  from xpedite.util.probeFactory import ProbeIndexFactory
  remote = None
  global CONTEXT, CAN_RECORD_PMC # pylint: disable=global-statement
  ProbeIndexFactory.reset()
  if not isIpLocal(hostname):
    remote = Remote(hostname, makeLogPath('remote'))
    remote.__enter__()
  CAN_RECORD_PMC = recordPMC
  CONTEXT = Context(transactions, multithreaded, workspace)
  SCENARIO_LOADER.loadScenarios(rundir, apps, scenarioTypes, remote)
  yield
  if remote:
    remote.__exit__(None, None, None)
Example #2
0
    def start(self):
        """
    Loads appInfo and establishes tcp connection to the target application.

    This method builds an enviroment instance, to seamlessly establish a local or remote tcp connection
    with the target application

    """
        isLocal = isIpLocal(self.ip)
        LOGGER.debug('Starting xpedite client | %s ip - %s',
                     'LOCAL' if isLocal else 'REMOTE', self.ip)
        LOGGER.debug('app info file - %s', self._appInfoPath)
        self.env = (Environment(self.ip, self._appInfoPath,
                                self.dryRun) if isLocal else RemoteEnvironment(
                                    self.ip, self._appInfoPath, self.dryRun))
        self.env.__enter__()
Example #3
0
def set_hostname(hostname):
    """
  A method run at the beginning of tests to create and enter a remote environment
  and at the end of tests to exit the remote environment

  @param hostname: An option added to the pytest parser to accept a remote host
                   Defaults to 127.0.0.1
  @type hostname: C{str}
  """
    from xpedite.util import makeLogPath
    from xpedite.transport.net import isIpLocal
    from xpedite.transport.remote import Remote
    global remote
    if not isIpLocal(hostname):
        remote = Remote(hostname, makeLogPath('remote'))
        remote.__enter__()
    yield
    if remote:
        remote.__exit__(None, None, None)
Example #4
0
def setTestParameters(hostname, transactions, multithreaded, workspace,
                      tempdir):
    """
  A method run at the beginning of tests to create and enter a REMOTE environment
  and at the end of tests to exit the REMOTE environment

 @param hostname: An option added to the pytest parser to accept a REMOTE host
                   Defaults to 127.0.0.1
  @type hostname: C{str}
  """
    from xpedite.util import makeLogPath
    from xpedite.transport.net import isIpLocal
    from xpedite.transport.remote import Remote
    global DATA_DIR, REMOTE, TXN_COUNT, THREAD_COUNT, WORKSPACE  # pylint: disable=global-statement
    if not isIpLocal(hostname):
        REMOTE = Remote(hostname, makeLogPath('remote'))
        REMOTE.__enter__()
    TXN_COUNT = transactions
    THREAD_COUNT = multithreaded
    WORKSPACE = workspace
    DATA_DIR = os.path.join(tempdir, 'slowFixDecoder')
    yield
    if REMOTE:
        REMOTE.__exit__(None, None, None)