Skip to content

Commit

Permalink
fix: correct smoke tests os idempotency (#10829) (#10831)
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Mannocci <[email protected]>
(cherry picked from commit a86ea9e)

# Conflicts:
#	testing/smoke/test_supported_os.sh

Co-authored-by: Adrien Mannocci <[email protected]>
  • Loading branch information
mergify[bot] and amannocci authored May 17, 2023
1 parent 75dc6f5 commit 0955af8
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions testing/smoke/test_supported_os.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0955af8

Please sign in to comment.