From 0955af8a7f2e40801a3654674fc4594ec965ca9c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 17 May 2023 13:42:12 +0000 Subject: [PATCH] fix: correct smoke tests os idempotency (#10829) (#10831) Signed-off-by: Adrien Mannocci (cherry picked from commit a86ea9eaf50141e23e35cd75f60bcffa6ae815a6) # Conflicts: # testing/smoke/test_supported_os.sh Co-authored-by: Adrien Mannocci --- testing/smoke/test_supported_os.sh | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 testing/smoke/test_supported_os.sh diff --git a/testing/smoke/test_supported_os.sh b/testing/smoke/test_supported_os.sh new file mode 100644 index 00000000000..9249b1a5eb4 --- /dev/null +++ b/testing/smoke/test_supported_os.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +set -eo pipefail + +KEY_NAME="provisioner_key_$(date +%s)" + +ssh-keygen -f ${KEY_NAME} -N "" + +# Load common lib +. $(git rev-parse --show-toplevel)/testing/smoke/lib.sh + +# Get all the versions from the current region. +get_latest_snapshot + +VERSION=${1} +if [[ -z ${VERSION} ]] || [[ "${VERSION}" == "latest" ]]; then + VERSION=$(echo ${VERSIONS} | jq -r 'last') + echo "-> unspecified version, using $(echo ${VERSION} | cut -d '.' -f1-2)" +fi +MAJOR_VERSION=$(echo ${VERSION} | cut -d '.' -f1 ) +MINOR_VERSION=$(echo ${VERSION} | cut -d '.' -f2 ) + +OBSERVER_VERSION=$(echo ${VERSION} | cut -d '-' -f1 ) + +if [[ ${MAJOR_VERSION} -eq 8 ]]; then + ASSERT_EVENTS_FUNC=data_stream_assertions + INTEGRATIONS_SERVER=true + + get_latest_patch "${MAJOR_VERSION}.${MINOR_VERSION}" + LATEST_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${LATEST_PATCH} +else + echo "version ${VERSION} not supported" + exit 5 +fi + +echo "-> Running basic supported OS smoke test for version ${VERSION}" + +if [[ -z ${SKIP_DESTROY} ]]; then + trap "terraform_destroy 0" EXIT +fi + +. $(git rev-parse --show-toplevel)/testing/smoke/os_matrix.sh + +for os in "${os_names[@]}" +do + cleanup_tfvar + append_tfvar "aws_provisioner_key_name" ${KEY_NAME} + append_tfvar "aws_os" $os + append_tfvar "stack_version" ${VERSION} + terraform_apply + # The previous test case's APM Server should have been stopped by now, + # so there should be no new documents indexed. Delete all existing data. + delete_all + healthcheck 1 + send_events + ${ASSERT_EVENTS_FUNC} ${OBSERVER_VERSION} +done