Skip to content

Commit

Permalink
Add expected errors for benchmark test package [false positive test] (#…
Browse files Browse the repository at this point in the history
…2017)

Force to fail rally_benchmark_malformed_template test package
by updating the template.ndjson file as suggested in the README.md.
Added an error in the template file as well as the expected errors for
the rally_benchmark_malformed_template test package.
  • Loading branch information
mrodm authored Aug 14, 2024
1 parent 3969afa commit d5f5955
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
DOCKER_VERSION: "26.1.2"
KIND_VERSION: 'v0.20.0'
K8S_VERSION: 'v1.30.0'
YQ_VERSION: 'v4.44.3'
LINUX_AGENT_IMAGE: "golang:${GO_VERSION}"
# Using this one instead of family/core-windows-2022 because of conflicts with the pre-installed docker.
WINDOWS_AGENT_IMAGE: "family/platform-ingest-beats-windows-2022"
Expand Down
17 changes: 17 additions & 0 deletions .buildkite/scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,23 @@ with_jq() {
jq --version
}

with_yq() {
create_bin_folder
check_platform_architecture
local binary="yq_${platform_type_lowercase}_${arch_type}"
local bin_folder="${WORKSPACE}/bin"

retry 5 curl -sSL -o "${bin_folder}/yq.tar.gz" "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${binary}.tar.gz"

tar -C "${bin_folder}" -xpf "${bin_folder}/yq.tar.gz" "./${binary}"

mv "${bin_folder}/${binary}" "${bin_folder}/yq"
chmod +x "${bin_folder}/yq"
yq --version

rm -rf "${bin_folder}/yq.tar.gz"
}

with_aws_cli() {
check_platform_architecture

Expand Down
6 changes: 6 additions & 0 deletions .buildkite/scripts/integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ if [[ "$SERVERLESS" == "false" ]]; then
with_docker_compose_plugin
fi

if [[ "${TARGET}" == "${FALSE_POSITIVES_TARGET}" ]]; then
# just required for now while testing false positive targets
echo "--- install yq"
with_yq
fi

if [[ "${TARGET}" == "${KIND_TARGET}" || "${TARGET}" == "${SYSTEM_TEST_FLAGS_TARGET}" ]]; then
echo "--- install kubectl & kind"
with_kubernetes
Expand Down
6 changes: 4 additions & 2 deletions scripts/test-check-false-positives.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ function cleanup() {
function check_expected_errors() {
local package_root=$1
local package_name=""
local package_name_manifest=""
package_name=$(basename "$1")
package_name_manifest=$(cat "$package_root/manifest.yml" | yq -r '.name')
local expected_errors_file="${package_root%/}.expected_errors"
local result_tests="build/test-results/${package_name}-*.xml"
local result_tests="build/test-results/${package_name_manifest}-*.xml"
local results_no_spaces="build/test-results-no-spaces.xml"

if [ ! -f "${expected_errors_file}" ]; then
Expand All @@ -43,7 +45,7 @@ function check_expected_errors() {

# check number of expected errors
local number_errors
number_errors=$(cat ${result_tests} | grep "<failure>" | wc -l)
number_errors=$(cat ${result_tests} | grep -E '<failure>|<error>' | wc -l)
local expected_errors
expected_errors=$(cat ${expected_errors_file} | wc -l)

Expand Down
1 change: 0 additions & 1 deletion test/packages/false_positives/failure_store.stack_version

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<error>failed to initialize backfill generator for scenario &#34;logs-benchmark&#34;: template: generator:12: unexpected &#34;}&#34; in operand</error>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- $timestamp := generate "timestamp" -}}
{
"@timestamp": "{{ $timestamp.Format "2006-01-02T15:04:05.999999Z07:00" }}",
"data_stream.type": "logs",
data_stream.type": "logs",
"data_stream.dataset": "rally_benchmarks.testds",
"data_stream.namespace": "ep",
"container.id": "{{ generate "container.id" }}",
Expand All @@ -11,4 +11,4 @@
"log.offset": {{ generate "log.offset" }},
"tags": ["rally_benchmark.testds", "forwarded", "{{ generate "tags" }" ],
"message": "{{ generate "IP" }} - - [{{ $timestamp.Format "02/Jan/2006:15:04:05.999999 -0700" }}] \"GET /favicon.ico HTTP/1.1\" {{ generate "StatusCode" }} {{ generate "Size" }} \"http://{{ generate "Hostname" }}:{{ generate "Port" }}/\" \"skip-this-one/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36\""
}
}

0 comments on commit d5f5955

Please sign in to comment.