예제 #1
0
파일: tracker_test.py 프로젝트: yuerl/rally
def test_create_track(cfg, tmp_path, test_cluster):
    # prepare some data
    cmd = f"--test-mode --pipeline=benchmark-only --target-hosts=127.0.0.1:{test_cluster.http_port} " \
          f" --track=geonames --challenge=append-no-conflicts-index-only --quiet"
    assert it.race(cfg, cmd) == 0

    # create the track
    track_name = f"test-track-{uuid.uuid4()}"
    track_path = tmp_path / track_name

    assert it.esrally(cfg, f"create-track --target-hosts=127.0.0.1:{test_cluster.http_port} --indices=geonames "
                           f"--track={track_name} --output-path={tmp_path}") == 0

    expected_files = ["track.json",
                      "geonames.json",
                      "geonames-documents-1k.json",
                      "geonames-documents.json",
                      "geonames-documents-1k.json.bz2",
                      "geonames-documents.json.bz2"]

    for f in expected_files:
        full_path = track_path / f
        assert full_path.exists(), f"Expected file to exist at path [{full_path}]"

    # run a benchmark with the created track
    cmd = f"--test-mode --pipeline=benchmark-only --target-hosts=127.0.0.1:{test_cluster.http_port} --track-path={track_path}"
    assert it.race(cfg, cmd) == 0
예제 #2
0
def test_sources(cfg):
    it.wait_until_port_is_free()
    assert it.race(
        cfg, "--revision=latest --track=geonames --test-mode "
        "--challenge=append-no-conflicts --car=4gheap --elasticsearch-plugins=analysis-icu"
    ) == 0

    it.wait_until_port_is_free()
    assert it.race(
        cfg, "--pipeline=from-sources --track=geonames --test-mode "
        "--challenge=append-no-conflicts-index-only --car=\"4gheap,ea\"") == 0
예제 #3
0
def test_sources(cfg):
    port = 19200
    it.wait_until_port_is_free(port_number=port)
    assert it.race(
        cfg,
        f"--revision=latest --track=geonames --test-mode  --target-hosts=127.0.0.1:{port} "
        f"--challenge=append-no-conflicts --car=4gheap --elasticsearch-plugins=analysis-icu"
    ) == 0

    it.wait_until_port_is_free(port_number=port)
    assert it.race(
        cfg,
        f"--pipeline=from-sources --track=geonames --test-mode --target-hosts=127.0.0.1:{port} "
        f"--challenge=append-no-conflicts-index-only --car=\"4gheap,ea\"") == 0
예제 #4
0
def test_create_track(cfg, tmp_path, test_cluster):
    # use 0.05% of geonames corpus to generate data. We need something small but >1000 docs to properly test
    # the -1k corpus too.
    cmd = (
        f"--pipeline=benchmark-only --target-hosts=127.0.0.1:{test_cluster.http_port} --track=geonames "
        f'--challenge=append-no-conflicts-index-only --track-params="ingest_percentage:0.05" --on-error=abort '
        f'--include-tasks="delete-index,create-index,check-cluster-health,index-append" --quiet'
    )
    assert it.race(cfg, cmd) == 0

    # create the track
    track_name = f"test-track-{uuid.uuid4()}"
    track_path = tmp_path / track_name

    assert (it.esrally(
        cfg,
        f"create-track --target-hosts=127.0.0.1:{test_cluster.http_port} --indices=geonames "
        f"--track={track_name} --output-path={tmp_path}",
    ) == 0)

    base_generated_corpora = "geonames-documents"
    expected_files = [
        "track.json",
        "geonames.json",
        f"{base_generated_corpora}-1k.json",
        f"{base_generated_corpora}.json",
        f"{base_generated_corpora}-1k.json.bz2",
        f"{base_generated_corpora}.json.bz2",
    ]

    for f in expected_files:
        full_path = track_path / f
        assert full_path.exists(
        ), f"Expected file to exist at path [{full_path}]"

    with open(track_path / f"{base_generated_corpora}-1k.json", "rt") as f:
        num_lines = sum(1 for line in f)
    assert (
        num_lines == 1000
    ), f"Corpora [{base_generated_corpora}-1k.json] used by test-mode is [{num_lines}] lines but should be 1000 lines"

    # run a benchmark in test mode with the created track
    cmd = f"--test-mode --pipeline=benchmark-only --target-hosts=127.0.0.1:{test_cluster.http_port} --track-path={track_path}"
    assert it.race(cfg, cmd) == 0

    # and also run a normal (short) benchmark using the created track
    cmd = f"--pipeline=benchmark-only --target-hosts=127.0.0.1:{test_cluster.http_port} --track-path={track_path}"
    assert it.race(cfg, cmd) == 0
예제 #5
0
def test_docker_distribution(cfg):
    # only test the most recent Docker distribution
    dist = it.DISTRIBUTIONS[-1]
    it.wait_until_port_is_free(port_number=19200)
    assert it.race(cfg, f"--pipeline=\"docker\" --distribution-version=\"{dist}\" "
                           f"--track=\"geonames\" --challenge=\"append-no-conflicts-index-only\" --test-mode "
                           f"--car=4gheap --target-hosts=127.0.0.1:19200") == 0
예제 #6
0
def test_tar_distributions(cfg):
    for dist in it.DISTRIBUTIONS:
        for track in it.TRACKS:
            it.wait_until_port_is_free()
            assert it.race(
                cfg, f"--distribution-version=\"{dist}\" --track=\"{track}\" "
                f"--test-mode --car=4gheap") == 0
예제 #7
0
def execute_eventdata(cfg, test_cluster, challenges, track_params):
    for challenge in challenges:
        cmd = (
            f"--test-mode --pipeline=benchmark-only --target-host=127.0.0.1:{test_cluster.http_port} "
            f'--track-repository=eventdata --track=eventdata --track-params="{track_params}" '
            f"--challenge={challenge}"
        )
        assert it.race(cfg, cmd) == 0
예제 #8
0
def test_tar_distributions(cfg):
    port = 19200
    for dist in it.DISTRIBUTIONS:
        for track in it.TRACKS:
            it.wait_until_port_is_free(port_number=port)
            assert it.race(
                cfg, f"--distribution-version=\"{dist}\" --track=\"{track}\" "
                f"--test-mode --car=4gheap --target-hosts=127.0.0.1:{port}"
            ) == 0
예제 #9
0
def test_does_not_benchmark_unsupported_distribution(cfg):
    port = 19200
    it.wait_until_port_is_free(port_number=port)
    assert (
        it.race(
            cfg, f'--distribution-version="1.7.6" --track="{it.TRACKS[0]}" ' f"--target-hosts=127.0.0.1:{port} --test-mode --car=4gheap"
        )
        != 0
    )
예제 #10
0
def test_track_dependencies(cfg):
    port = 19200
    it.wait_until_port_is_free(port_number=port)
    dist_version = it.DISTRIBUTIONS[-1]
    cwd = os.path.dirname(__file__)
    track_path = os.path.join(cwd, "resources", "track_with_dependency")
    # workaround for MacOS and Python deficiency. http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html
    os.environ["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES"
    assert it.race(
        cfg,
        f"--distribution-version={dist_version} --track-path={track_path} --car=4gheap,basic-license"
    ) == 0
예제 #11
0
def test_tar_distributions(cfg):
    port = 19200
    for dist in it.DISTRIBUTIONS:
        for track in it.TRACKS:
            it.wait_until_port_is_free(port_number=port)
            assert (
                it.race(
                    cfg,
                    f'--distribution-version="{dist}" --track="{track}" '
                    f"--test-mode --car=4gheap,basic-license --target-hosts=127.0.0.1:{port}",
                )
                == 0
            )
예제 #12
0
def test_docker_distribution(cfg):
    port = 19200
    # only test the most recent Docker distribution
    dist = it.DISTRIBUTIONS[-1]
    it.wait_until_port_is_free(port_number=port)
    assert (
        it.race(
            cfg,
            f'--pipeline="docker" --distribution-version="{dist}" '
            f'--track="geonames" --challenge="append-no-conflicts-index-only" --test-mode '
            f"--car=4gheap,basic-license --target-hosts=127.0.0.1:{port}",
        )
        == 0
    )