Beispiel #1
0
def branches(src_dir, remote=True):
    if remote:
        # alternatively: git for-each-ref refs/remotes/ --format='%(refname:short)'
        return _cleanup_remote_branch_names(process.run_subprocess_with_output(
                "git -C {src} for-each-ref refs/remotes/ --format='%(refname:short)'".format(src=src_dir)))
    else:
        return _cleanup_local_branch_names(
                process.run_subprocess_with_output(
                        "git -C {src} for-each-ref refs/heads/ --format='%(refname:short)'".format(src=src_dir)))
Beispiel #2
0
 def probe(src, *args, **kwargs):
     # Probe for -C
     if not process.exit_status_as_bool(lambda: process.run_subprocess_with_logging("git -C %s --version" % src, level=logging.DEBUG)):
         version = process.run_subprocess_with_output("git --version")
         if version:
             version = str(version).strip()
         else:
             version = "Unknown"
         raise exceptions.SystemSetupError("Your git version is [%s] but Rally requires at least git 1.9. Please update git." % version)
     return f(src, *args, **kwargs)
Beispiel #3
0
def system_property(java_home, system_property_name):
    lines = process.run_subprocess_with_output("%s/bin/java -XshowSettings:properties -version" % java_home)
    # matches e.g. "    java.runtime.version = 1.8.0_121-b13" and captures "1.8.0_121-b13"
    sys_prop_pattern = re.compile(r".*%s.*=\s?(.*)" % system_property_name)
    for line in lines:
        m = sys_prop_pattern.match(line)
        if m:
            return m.group(1)

    return None
Beispiel #4
0
 def probe(src, *args, **kwargs):
     # Probe for -C
     if not process.exit_status_as_bool(
             lambda: process.run_subprocess_with_logging(
                 "git -C {} --version".format(src), level=logging.DEBUG),
             quiet=True):
         version = process.run_subprocess_with_output("git --version")
         if version:
             version = str(version).strip()
         else:
             version = "Unknown"
         raise exceptions.SystemSetupError(
             "Your git version is [%s] but Rally requires at least git 1.9. Please update git."
             % version)
     return f(src, *args, **kwargs)
Beispiel #5
0
 def install(self, distribution_version, node_name, car, http_port):
     self.http_port = http_port
     transport_port = http_port + 100
     try:
         output = process.run_subprocess_with_output(
             "esrally install --configuration-name={cfg} --quiet --distribution-version={dist} --build-type=tar "
             "--http-port={http_port} --node={node_name} --master-nodes={node_name} --car={car} "
             "--seed-hosts=\"127.0.0.1:{transport_port}\"".format(cfg=self.cfg,
                                                                  dist=distribution_version,
                                                                  http_port=http_port,
                                                                  node_name=node_name,
                                                                  car=car,
                                                                  transport_port=transport_port))
         self.installation_id = json.loads("".join(output))["installation-id"]
     except BaseException as e:
         raise AssertionError("Failed to install Elasticsearch {}.".format(distribution_version), e)
Beispiel #6
0
def test_run_without_http_connection(cfg):
    cmd = it.esrally_command_line_for(cfg, "list races")
    output = process.run_subprocess_with_output(cmd, {"http_proxy": "http://invalid"})
    expected = "No Internet connection detected. Specify --offline"
    assert expected in "\n".join(output)
Beispiel #7
0
def test_run_with_help(cfg):
    cmd = it.esrally_command_line_for(cfg, "--help")
    output = process.run_subprocess_with_output(cmd)
    expected = "usage: esrally [-h] [--version]"
    assert expected in "\n".join(output)
Beispiel #8
0
def tags(src_dir):
    return _cleanup_tag_names(
        process.run_subprocess_with_output("git -C {0} tag".format(
            io.escape_path(src_dir))))
Beispiel #9
0
def current_branch(src_dir):
    return process.run_subprocess_with_output(
        "git -C {0} rev-parse --abbrev-ref HEAD".format(
            io.escape_path(src_dir)))[0].strip()
Beispiel #10
0
def head_revision(src_dir):
    return process.run_subprocess_with_output(
        "git -C {0} rev-parse --short HEAD".format(
            io.escape_path(src_dir)))[0].strip()
Beispiel #11
0
 def _get_container_id(self, compose_config):
     compose_ps_cmd = self._docker_compose(compose_config, "ps -q")
     return process.run_subprocess_with_output(compose_ps_cmd)[0]
Beispiel #12
0
def head_revision(src_dir):
    return process.run_subprocess_with_output(
        "git -C {0} rev-parse --short HEAD".format(src_dir))[0]
Beispiel #13
0
def pull_ts(src_dir, ts):
    fetch(src_dir)
    revision = process.run_subprocess_with_output(
        "git -C {0} rev-list -n 1 --before=\"{1}\" --date=iso8601 origin/master".format(src_dir, ts))[0].strip()
    if process.run_subprocess_with_logging("git -C {0} checkout {1}".format(src_dir, revision)):
        raise exceptions.SupplyError("Could not checkout source tree for timestamped revision [%s]" % ts)
Beispiel #14
0
def head_revision(src_dir):
    return process.run_subprocess_with_output("git -C {0} rev-parse --short HEAD".format(src_dir))[0].strip()