Skip to content

Commit

Permalink
Test JDK version as part of PR builder [DI-317] (#816)
Browse files Browse the repository at this point in the history
Adds additional assertion to the PR builder smoke test that the JDK is
the version expected for the image.

This is currently a _manual, post release_ check, moving earlier in the
cycle to catch defects earlier.

Fixes: [DI-317](https://hazelcast.atlassian.net/browse/DI-317)

Post merge actions:
- [ ] backport
- [ ] _Discuss_ if we remove the manual, post-release check?

[DI-317]:
https://hazelcast.atlassian.net/browse/DI-317?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
JackPGreen committed Nov 5, 2024
1 parent cea9844 commit 5f22046
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/scripts/simple-smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ function stop_container() {
docker stop "${container_name}"
}

function check_java_version() {
local expected_major_version=$1
local actual_major_version
actual_major_version=$(docker run --rm "${image}" sh -c 'java -version 2>&1 | head -n 1 | awk -F "\"" "{print \$2}" | awk -F "." "{print \$1}"')

if [[ "${expected_major_version}" == "${actual_major_version}" ]]; then
echo "Expected Java version (${expected_distribution_type}) identified."
else
echoerr "Expected Java version '${expected_major_version}' but got '${actual_major_version}'"
exit 1;
fi
}

function derive_expected_distribution_type() {
local input_distribution_type=$1

Expand All @@ -50,6 +63,7 @@ image=$1
container_name=$2
input_distribution_type=$3
expected_version=$4
expected_java_major_version=$5


remove_container_if_exists
Expand All @@ -59,3 +73,4 @@ trap stop_container EXIT

expected_distribution_type=$(derive_expected_distribution_type "${input_distribution_type}")
test_package "${expected_distribution_type}" "${expected_version}"
check_java_version "${expected_java_major_version}"

0 comments on commit 5f22046

Please sign in to comment.