def test_store_race(self): from esrally import time schedule = [ track.Task("index #1", track.Operation("index", track.OperationType.Bulk)) ] t = track.Track( name="unittest", indices=[track.Index(name="tests", types=["test-type"])], challenges=[ track.Challenge(name="index", default=True, schedule=schedule) ]) race = metrics.Race(rally_version="0.4.4", environment_name="unittest", trial_id=FileRaceStoreTests.TRIAL_ID, trial_timestamp=FileRaceStoreTests.TRIAL_TIMESTAMP, pipeline="from-sources", user_tags={"os": "Linux"}, track=t, track_params={"clients": 12}, challenge=t.default_challenge, car="4gheap", total_laps=12, cluster=FileRaceStoreTests.DictHolder({ "distribution-version": "5.0.0", "nodes": [{ "node_name": "node0", "ip": "127.0.0.1" }] }), lap_results=[], results=FileRaceStoreTests.DictHolder({ "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [{ "task": "index #1", "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }] })) self.race_store.store_race(race) retrieved_race = self.race_store.find_by_timestamp( timestamp=time.to_iso8601(FileRaceStoreTests.TRIAL_TIMESTAMP)) self.assertEqual(race.trial_timestamp, retrieved_race.trial_timestamp) self.assertEqual(1, len(self.race_store.list()))
def test_store_results(self): # here we need the real thing from esrally import reporter from esrally.mechanic import cluster schedule = [ track.Task(track.Operation("index", track.OperationType.Index)) ] t = track.Track(name="unittest-track", short_description="unittest track", source_root_url="http://example.org", indices=[ track.Index(name="tests", auto_managed=True, types=[ track.Type(name="test-type", mapping_file=None) ]) ], challenges=[ track.Challenge(name="index", description="Index", default=True, index_settings=None, schedule=schedule) ]) c = cluster.Cluster([], [], None) c.distribution_version = "5.0.0" node = c.add_node("localhost", "rally-node-0") node.plugins.append("x-pack") race = metrics.Race( rally_version="0.4.4", environment_name="unittest", trial_timestamp=EsResultsStoreTests.TRIAL_TIMESTAMP, pipeline="from-sources", user_tag="let-me-test", track=t, challenge=t.default_challenge, car="4gheap", total_laps=12, cluster=c, lap_results=[], results=reporter.Stats({ "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [{ "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }] })) self.race_store.store_results(race) expected_docs = [{ "environment": "unittest", "trial-timestamp": "20160131T000000Z", "distribution-version": "5.0.0", "distribution-major-version": 5, "user-tag": "let-me-test", "track": "unittest-track", "challenge": "index", "car": "4gheap", "node-count": 1, "plugins": ["x-pack"], "active": True, "name": "old_gc_time", "value": { "single": 5 } }, { "environment": "unittest", "trial-timestamp": "20160131T000000Z", "distribution-version": "5.0.0", "distribution-major-version": 5, "user-tag": "let-me-test", "track": "unittest-track", "challenge": "index", "car": "4gheap", "node-count": 1, "plugins": ["x-pack"], "active": True, "name": "throughput", "operation": "index", "value": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }, { "environment": "unittest", "trial-timestamp": "20160131T000000Z", "distribution-version": "5.0.0", "distribution-major-version": 5, "user-tag": "let-me-test", "track": "unittest-track", "challenge": "index", "car": "4gheap", "node-count": 1, "plugins": ["x-pack"], "active": True, "name": "young_gc_time", "value": { "single": 100 } }] self.es_mock.bulk_index.assert_called_with( index="rally-results-2016-01", doc_type="results", items=expected_docs)
def test_store_race(self): schedule = [ track.Task(track.Operation("index", track.OperationType.Index)) ] t = track.Track(name="unittest", short_description="unittest track", source_root_url="http://example.org", indices=[ track.Index(name="tests", auto_managed=True, types=[ track.Type(name="test-type", mapping_file=None) ]) ], challenges=[ track.Challenge(name="index", description="Index", default=True, index_settings=None, schedule=schedule) ]) race = metrics.Race(rally_version="0.4.4", environment_name="unittest", trial_timestamp=EsRaceStoreTests.TRIAL_TIMESTAMP, pipeline="from-sources", user_tag="let-me-test", track=t, challenge=t.default_challenge, car="4gheap", total_laps=12, cluster=EsRaceStoreTests.DictHolder({ "distribution-version": "5.0.0", "nodes": [{ "node_name": "node0", "ip": "127.0.0.1", "plugins": ["analysis-icu", "x-pack"] }] }), lap_results=[], results=EsRaceStoreTests.DictHolder({ "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [{ "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }] })) self.race_store.store_race(race) expected_doc = { "rally-version": "0.4.4", "environment": "unittest", "trial-timestamp": "20160131T000000Z", "pipeline": "from-sources", "user-tag": "let-me-test", "track": "unittest", "challenge": "index", "car": "4gheap", "total-laps": 12, "cluster": { "distribution-version": "5.0.0", "nodes": [{ "node_name": "node0", "ip": "127.0.0.1", "plugins": ["analysis-icu", "x-pack"] }] }, "results": { "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [{ "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }] } } self.es_mock.index.assert_called_with(index="rally-races-2016-01", doc_type="races", item=expected_doc)
def test_store_race(self): from esrally import time schedule = [ track.Task(track.Operation("index", track.OperationType.Index)) ] t = track.Track(name="unittest", short_description="unittest track", source_root_url="http://example.org", indices=[ track.Index(name="tests", auto_managed=True, types=[ track.Type(name="test-type", mapping_file=None) ]) ], challenges=[ track.Challenge(name="index", description="Index", default=True, index_settings=None, schedule=schedule) ]) race = metrics.Race(rally_version="0.4.4", environment_name="unittest", trial_timestamp=FileRaceStoreTests.TRIAL_TIMESTAMP, pipeline="from-sources", user_tag="let-me-test", track=t, challenge=t.default_challenge, car="4gheap", total_laps=12, cluster=FileRaceStoreTests.DictHolder({ "distribution-version": "5.0.0", "nodes": [{ "node_name": "node0", "ip": "127.0.0.1" }] }), lap_results=[], results=FileRaceStoreTests.DictHolder({ "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [{ "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }] })) self.race_store.store_race(race) retrieved_race = self.race_store.find_by_timestamp( timestamp=time.to_iso8601(FileRaceStoreTests.TRIAL_TIMESTAMP)) self.assertEqual(race.trial_timestamp, retrieved_race.trial_timestamp) self.assertEqual(1, len(self.race_store.list()))
def test_store_race(self): schedule = [ track.Task("index #1", track.Operation("index", track.OperationType.Bulk)) ] t = track.Track( name="unittest", indices=[track.Index(name="tests", types=["test-type"])], challenges=[ track.Challenge(name="index", default=True, schedule=schedule) ]) race = metrics.Race(rally_version="0.4.4", environment_name="unittest", trial_id=EsRaceStoreTests.TRIAL_ID, trial_timestamp=EsRaceStoreTests.TRIAL_TIMESTAMP, pipeline="from-sources", user_tags={"os": "Linux"}, track=t, track_params={"shard-count": 3}, challenge=t.default_challenge, car="4gheap", total_laps=12, cluster=EsRaceStoreTests.DictHolder({ "distribution-version": "5.0.0", "nodes": [{ "node_name": "node0", "ip": "127.0.0.1", "plugins": ["analysis-icu", "x-pack"] }] }), lap_results=[], results=EsRaceStoreTests.DictHolder({ "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [{ "task": "index #1", "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }] })) self.race_store.store_race(race) expected_doc = { "rally-version": "0.4.4", "environment": "unittest", "trial-id": EsRaceStoreTests.TRIAL_ID, "trial-timestamp": "20160131T000000Z", "pipeline": "from-sources", "user-tags": { "os": "Linux" }, "track": "unittest", "track-params": { "shard-count": 3 }, "challenge": "index", "car": "4gheap", "total-laps": 12, "cluster": { "distribution-version": "5.0.0", "nodes": [{ "node_name": "node0", "ip": "127.0.0.1", "plugins": ["analysis-icu", "x-pack"] }] }, "results": { "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [{ "task": "index #1", "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }] } } self.es_mock.index.assert_called_with(index="rally-races-2016-01", doc_type="races", item=expected_doc)
def test_store_results(self): # here we need the real thing from esrally import reporter from esrally.mechanic import cluster schedule = [ track.Task("index #1", track.Operation("index", track.OperationType.Bulk)) ] t = track.Track(name="unittest-track", indices=[track.Index(name="tests", types=["test-type"])], challenges=[track.Challenge(name="index", default=True, schedule=schedule)]) c = cluster.Cluster([], [], None) c.distribution_version = "5.0.0" node = c.add_node("localhost", "rally-node-0") node.plugins.append("x-pack") race = metrics.Race(rally_version="0.4.4", environment_name="unittest", trial_id=EsResultsStoreTests.TRIAL_ID, trial_timestamp=EsResultsStoreTests.TRIAL_TIMESTAMP, pipeline="from-sources", user_tags={"os": "Linux"}, track=t, track_params=None, challenge=t.default_challenge, car="4gheap", car_params=None, plugin_params={"some-param": True}, total_laps=12, cluster=c, lap_results=[], results=reporter.Stats( { "young_gc_time": 100, "old_gc_time": 5, "op_metrics": [ { "task": "index #1", "operation": "index", "throughput": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } } ], "node_metrics": [ { "node": "rally-node-0", "startup_time": 3.4 } ] }) ) self.race_store.store_results(race) expected_docs = [ { "rally-version": "0.4.4", "environment": "unittest", "trial-id": EsResultsStoreTests.TRIAL_ID, "trial-timestamp": "20160131T000000Z", "distribution-version": "5.0.0", "distribution-major-version": 5, "user-tags": { "os": "Linux" }, "track": "unittest-track", "challenge": "index", "car": "4gheap", "plugin-params": { "some-param": True }, "node-count": 1, "plugins": ["x-pack"], "active": True, "name": "old_gc_time", "value": { "single": 5 } }, { "rally-version": "0.4.4", "environment": "unittest", "trial-id": EsResultsStoreTests.TRIAL_ID, "trial-timestamp": "20160131T000000Z", "distribution-version": "5.0.0", "distribution-major-version": 5, "user-tags": { "os": "Linux" }, "track": "unittest-track", "challenge": "index", "car": "4gheap", "plugin-params": { "some-param": True }, "node-count": 1, "plugins": ["x-pack"], "active": True, "node": "rally-node-0", "name": "startup_time", "value": { "single": 3.4 }, }, { "rally-version": "0.4.4", "environment": "unittest", "trial-id": EsResultsStoreTests.TRIAL_ID, "trial-timestamp": "20160131T000000Z", "distribution-version": "5.0.0", "distribution-major-version": 5, "user-tags": { "os": "Linux" }, "track": "unittest-track", "challenge": "index", "car": "4gheap", "plugin-params": { "some-param": True }, "node-count": 1, "plugins": ["x-pack"], "active": True, "name": "throughput", "task": "index #1", "operation": "index", "value": { "min": 1000, "median": 1250, "max": 1500, "unit": "docs/s" } }, { "rally-version": "0.4.4", "environment": "unittest", "trial-id": EsResultsStoreTests.TRIAL_ID, "trial-timestamp": "20160131T000000Z", "distribution-version": "5.0.0", "distribution-major-version": 5, "user-tags": { "os": "Linux" }, "track": "unittest-track", "challenge": "index", "car": "4gheap", "plugin-params": { "some-param": True }, "node-count": 1, "plugins": ["x-pack"], "active": True, "name": "young_gc_time", "value": { "single": 100 } } ] self.es_mock.bulk_index.assert_called_with(index="rally-results-2016-01", doc_type="results", items=expected_docs)