Skip to content

Commit 044d019

Browse files
authored
Update legacy-standalone-major-managed to support 7->8->9 upgrade (#16131)
1 parent 5cda3ab commit 044d019

File tree

1 file changed

+46
-21
lines changed
  • testing/smoke/legacy-standalone-major-managed

1 file changed

+46
-21
lines changed

testing/smoke/legacy-standalone-major-managed/test.sh

+46-21
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,77 @@ if [[ "${1}" != "7.17" && "${1}" != "latest" ]]; then
77
exit 0
88
fi
99

10-
. $(git rev-parse --show-toplevel)/testing/smoke/lib.sh
10+
. "$(git rev-parse --show-toplevel)/testing/smoke/lib.sh"
1111

12-
VERSION=7.17
13-
get_versions
12+
VERSION_7=7.17
1413
if [[ "${1}" == "latest" ]]; then
15-
# a SNAPSHOT version can only be upgraded to another SNAPSHOT version
16-
get_latest_snapshot_for_version ${VERSION}
17-
LATEST_VERSION=${LATEST_SNAPSHOT_VERSION}
18-
ASSERTION_VERSION=${LATEST_SNAPSHOT_VERSION%-*} # strip -SNAPSHOT suffix
14+
# SNAPSHOT version can only be upgraded to another SNAPSHOT version
15+
get_latest_snapshot_for_version ${VERSION_7}
16+
LATEST_VERSION_7=${LATEST_SNAPSHOT_VERSION}
17+
ASSERTION_VERSION_7=${LATEST_SNAPSHOT_VERSION%-*} # strip -SNAPSHOT suffix
1918
get_latest_snapshot
20-
NEXT_MAJOR_LATEST=$(echo $VERSIONS | jq -r -c '.[-1]')
21-
ASSERTION_NEXT_MAJOR_LATEST=${NEXT_MAJOR_LATEST%-*} # strip -SNAPSHOT suffix
19+
LATEST_VERSION_8=$(echo "${VERSIONS}" | jq -r '[.[] | select(. | startswith("8"))] | last')
20+
ASSERTION_VERSION_8=${LATEST_VERSION_8%-*} # strip -SNAPSHOT suffix
21+
LATEST_VERSION_9=$(echo "${VERSIONS}" | jq -r '[.[] | select(. | startswith("9"))] | last')
22+
ASSERTION_VERSION_9=${LATEST_VERSION_9%-*} # strip -SNAPSHOT suffix
2223
else
23-
get_latest_patch ${VERSION}
24-
LATEST_VERSION=${VERSION}.${LATEST_PATCH}
25-
ASSERTION_VERSION=${LATEST_VERSION}
26-
NEXT_MAJOR_LATEST=$(echo ${VERSIONS} | jq -r '[.[] | select(. | startswith("8"))] | last')
27-
ASSERTION_NEXT_MAJOR_LATEST=${NEXT_MAJOR_LATEST}
24+
get_latest_patch ${VERSION_7}
25+
LATEST_VERSION_7=${VERSION_7}.${LATEST_PATCH}
26+
ASSERTION_VERSION_7=${LATEST_VERSION_7}
27+
get_versions
28+
LATEST_VERSION_8=$(echo "${VERSIONS}" | jq -r '[.[] | select(. | startswith("8"))] | last')
29+
ASSERTION_VERSION_8=${LATEST_VERSION_8}
30+
LATEST_VERSION_9=$(echo "${VERSIONS}" | jq -r '[.[] | select(. | startswith("9"))] | last')
31+
ASSERTION_VERSION_9=${LATEST_VERSION_9}
2832
fi
2933

30-
echo "-> Running ${LATEST_VERSION} standalone to ${NEXT_MAJOR_LATEST} to ${NEXT_MAJOR_LATEST} managed"
34+
if [[ -n ${LATEST_VERSION_9} ]]; then
35+
echo "-> Running ${LATEST_VERSION_7} standalone to ${LATEST_VERSION_8} standalone to ${LATEST_VERSION_9} standalone to ${LATEST_VERSION_9} managed"
36+
else
37+
echo "-> Running ${LATEST_VERSION_7} standalone to ${LATEST_VERSION_8} standalone to ${LATEST_VERSION_8} managed"
38+
fi
3139

3240
if [[ -z ${SKIP_DESTROY} ]]; then
3341
trap "terraform_destroy" EXIT
3442
fi
3543

44+
# Version 7
3645
INTEGRATIONS_SERVER=false
3746
cleanup_tfvar
38-
append_tfvar "stack_version" ${LATEST_VERSION}
47+
append_tfvar "stack_version" "${LATEST_VERSION_7}"
3948
append_tfvar "integrations_server" ${INTEGRATIONS_SERVER}
4049
terraform_apply
4150
healthcheck 1
4251
send_events
43-
legacy_assertions ${ASSERTION_VERSION}
52+
legacy_assertions "${ASSERTION_VERSION_7}"
4453

54+
# Version 8
4555
cleanup_tfvar
46-
append_tfvar "stack_version" ${NEXT_MAJOR_LATEST}
56+
append_tfvar "stack_version" "${LATEST_VERSION_8}"
4757
append_tfvar "integrations_server" ${INTEGRATIONS_SERVER}
4858
terraform_apply
4959
healthcheck 1
5060
send_events
51-
data_stream_assertions ${ASSERTION_NEXT_MAJOR_LATEST}
61+
data_stream_assertions "${ASSERTION_VERSION_8}"
62+
63+
# Version 9 (if exists)
64+
MANAGED_VERSION="${LATEST_VERSION_8}"
65+
ASSERTION_MANAGED_VERSION="${ASSERTION_VERSION_8}"
66+
if [[ -n ${LATEST_VERSION_9} ]]; then
67+
cleanup_tfvar
68+
append_tfvar "stack_version" "${LATEST_VERSION_9}"
69+
append_tfvar "integrations_server" ${INTEGRATIONS_SERVER}
70+
terraform_apply
71+
healthcheck 1
72+
send_events
73+
data_stream_assertions "${ASSERTION_VERSION_9}"
74+
MANAGED_VERSION="${LATEST_VERSION_9}"
75+
ASSERTION_MANAGED_VERSION="${ASSERTION_VERSION_9}"
76+
fi
5277

53-
upgrade_managed ${NEXT_MAJOR_LATEST}
78+
upgrade_managed "${MANAGED_VERSION}"
5479
healthcheck 1
5580
send_events
5681
# Assert there are 2 instances of the same event, since we ingested data twice
5782
# using the same APM Server version.
58-
data_stream_assertions ${ASSERTION_NEXT_MAJOR_LATEST} 2
83+
data_stream_assertions "${ASSERTION_MANAGED_VERSION}" 2

0 commit comments

Comments
 (0)