Skip to content

Commit 8c6f2ec

Browse files
Add smoke test for all challenges (elastic#61)
With this commit we leverage new functionality in Rally to spin up a cluster before all challenges are executed. This allows us to run challenges which depend on others (e.g. query only challenges that rely on another challenge to actually put the data into the cluster). Closes elastic#49
1 parent b98ebac commit 8c6f2ec

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ install: venv-create
6060
. $(VENV_ACTIVATE_FILE); pip install --upgrade pip
6161
# install pytest for tests
6262
. $(VENV_ACTIVATE_FILE); pip3 install pytest==5.1.1
63+
# install (latest) Rally for smoke tests
64+
. $(VENV_ACTIVATE_FILE); pip3 install git+ssh://[email protected]/elastic/rally.git
6365

6466
clean:
6567
rm -rf .pytest_cache
@@ -68,4 +70,7 @@ test: check-venv
6870
# PYTHONDONTWRITEBYTECODE=1 ensures that we always see warnings (not just the first time)
6971
. $(VENV_ACTIVATE_FILE); PYTHONDONTWRITEBYTECODE=1; pytest
7072

71-
.PHONY: clean test prereq venv-create check-env
73+
it: check-venv
74+
. $(VENV_ACTIVATE_FILE); ./smoke-test.sh
75+
76+
.PHONY: clean test it prereq venv-create check-env

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ make install
384384
make test
385385
```
386386

387+
It also contains an integration test suite that can be run with `make it`.
388+
387389
License
388390
-------
389391

smoke-test.sh

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,57 @@ set -u
2424
# fail on pipeline errors, e.g. when grepping
2525
set -o pipefail
2626

27+
readonly RACE_ID=$(uuidgen)
2728
readonly ES_VERSION=${ES_VERSION:-7.3.0}
28-
# intentionally not tested (at the moment) because these challenges require running a different challenge first against the same cluster:
29+
30+
# the order matters here as later challenges might expect that some indices already exist that have been created by challenges running earlier. In particular, these challenges are affected:
2931
#
3032
# * frozen-querying (depends on frozen-data-generation)
3133
# * combined-indexing-and-querying (depends on any challenge that has already created elasticlogs-q* indices)
3234
# * elasticlogs-querying (depends on any challenge that has already created elasticlogs-q* indices)
35+
readonly CHALLENGES=(frozen-data-generation frozen-querying elasticlogs-continuous-index-and-query document_id_evaluation bulk-update shard-sizing index-logs-fixed-daily-volume max-indexing-querying index-and-query-logs-fixed-daily-volume shard-size-on-disk large-shard-sizing large-shard-id-type-evaluation elasticlogs-1bn-load combined-indexing-and-querying elasticlogs-querying)
36+
37+
INSTALL_ID=-1
38+
39+
function log {
40+
local ts=$(date -u "+%Y-%m-%dT%H:%M:%SZ")
41+
echo "[${ts}] [${1}] ${2}"
42+
}
43+
44+
function info {
45+
log "INFO" "${1}"
46+
}
47+
48+
function set_up {
49+
info "preparing cluster"
50+
INSTALL_ID=$(esrally install --quiet --distribution-version="${ES_VERSION}" --node-name="rally-node-0" --network-host="127.0.0.1" --http-port=39200 --master-nodes="rally-node-0" --seed-hosts="127.0.0.1:39300" | jq --raw-output '.["installation-id"]')
51+
esrally start --installation-id="${INSTALL_ID}" --race-id="${RACE_ID}"
52+
}
3353

34-
readonly CHALLENGES=(elasticlogs-continuous-index-and-query document_id_evaluation bulk-update shard-sizing frozen-data-generation index-logs-fixed-daily-volume max-indexing-querying index-and-query-logs-fixed-daily-volume shard-size-on-disk large-shard-sizing large-shard-id-type-evaluation elasticlogs-1bn-load)
54+
function run_test {
55+
echo "**************************************** TESTING LIST TRACKS *******************************************"
56+
esrally list tracks --track-path="${PWD}/eventdata"
57+
echo "**************************************** TESTING CHALLENGES *******************************************"
3558

36-
esrally list tracks --track-repository=eventdata
59+
for challenge in "${CHALLENGES[@]}"
60+
do
61+
info "Testing ${challenge}"
62+
esrally --race-id="${RACE_ID}" --test-mode --pipeline=benchmark-only --target-host=127.0.0.1:39200 --track-path="${PWD}/eventdata" --track-params="bulk_indexing_clients:1,number_of_replicas:0,daily_logging_volume:1MB,rate_limit_max:2,rate_limit_duration_secs:5,p1_bulk_indexing_clients:1,p2_bulk_indexing_clients:1,p1_duration_secs:5,p2_duration_secs:5,ops_per_25_gb:20" --challenge="${challenge}" --on-error=abort
63+
done
64+
}
3765

38-
for challenge in "${CHALLENGES[@]}"
39-
do
40-
esrally --test-mode --distribution-version=$ES_VERSION --track-repository=eventdata --track=eventdata --track-params="bulk_indexing_clients:1,number_of_replicas:0,daily_logging_volume:1MB" --challenge="${challenge}" --on-error=abort
41-
done
66+
function tear_down {
67+
info "tearing down"
68+
set +e
69+
esrally stop --installation-id="${INSTALL_ID}"
70+
set -e
71+
}
4272

73+
function main {
74+
set_up
75+
run_test
76+
}
4377

78+
trap "tear_down" EXIT
4479

80+
main

0 commit comments

Comments
 (0)