Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 31 additions & 19 deletions scripts/fetch_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,50 +260,62 @@ gettool_ginkgo() {
source "${SCRIPT_DIR}/../test/bin/common_versions.sh"

local -r repo_url="https://${GITHUB_TOKEN}@github.com/openshift/openshift-tests-private.git"
local -r repo_branch="${OPENSHIFT_TESTS_PRIVATE_REPO_BRANCH}"
local -r repo_commit="${OPENSHIFT_TESTS_PRIVATE_REPO_COMMIT}"
local clone_dir="${WORK_DIR}/openshift-tests-private"

local -r binary_path="${GINKGO_TEST_BINARY}"
local -r release_branch="release-4.${MINOR_VERSION}"

# Skip if binary already exists
[[ -f "${binary_path}" ]] && return 0
local -r handleresult_script="${HANDLERESULT_SCRIPT}"

# Check if Go is available
if ! command -v go &> /dev/null; then
echo "Error: Go is required to build openshift-tests-private binary"
return 1
fi

# Ensure binary directory exists
# Check if binary and handleresult.py already exist
[[ -f "${binary_path}" ]] && [[ -f "${handleresult_script}" ]] && return 0
mkdir -p "$(dirname "${binary_path}")"

# Use global WORK_DIR for cloning
local clone_dir="${WORK_DIR}/openshift-tests-private"

# Clone repository with release branch preference
if ! git clone --depth 1 --branch "${release_branch}" "${repo_url}" "${clone_dir}" 2>/dev/null; then
echo "Branch ${release_branch} not found, cloning default branch..."
if ! git clone --depth 1 "${repo_url}" "${clone_dir}"; then
echo "Error: Failed to clone repository"
return 1
fi
if ! git clone --depth 1000 --branch "${repo_branch}" "${repo_url}" "${clone_dir}" 2>/dev/null; then
echo "Error: Failed to clone repository"
return 1
fi

# Build the binary
pushd "${clone_dir}" &>/dev/null

local test_binary="./bin/extended-platform-tests"
go build -o "${test_binary}" ./cmd/extended-platform-tests
# Checkout a valid commit to be sure ginkgo tests are working
if ! (git checkout --quiet "${repo_commit}"); then
echo "Error: Failed to checkout specific commit"
return 1
fi

# Build the binary
make all

# Copy binary to centralized location
local test_binary="./bin/extended-platform-tests"
if [[ -f "${test_binary}" ]]; then
cp "${test_binary}" "${binary_path}"
chmod +x "${binary_path}"
echo "Binary installed to ${binary_path}"
popd &>/dev/null
else
echo "Error: Test binary not found after build"
popd &>/dev/null
return 1
fi

# Copy handleresult.py to the tools directory
local handleresult_script_local="./pipeline/handleresult.py"
if [[ -f "${handleresult_script_local}" ]] && [[ ! -f "${handleresult_script}" ]]; then
cp "${handleresult_script_local}" "${handleresult_script}"
chmod +x "${handleresult_script}"
echo "handleresult.py installed to ${handleresult_script}"
else
echo "Error: pipeline/handleresult.py not found in repository"
return 1
fi
popd &>/dev/null
}

tool_getters=$(declare -F | awk '$3 ~ /^gettool_/ {print $3}' | sed 's/^gettool_//g')
Expand Down
1 change: 1 addition & 0 deletions test/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export IMAGEDIR="${OUTPUTDIR}/test-images"

# Ginkgo test binary path
export GINKGO_TEST_BINARY="${OUTPUTDIR}/bin/extended-platform-tests"
export HANDLERESULT_SCRIPT="${OUTPUTDIR}/bin/handleresult.py"

# The storage pool base name for VMs.
# The actual pool names will be '${VM_POOL_BASENAME}-${SCENARIO}'.
Expand Down
9 changes: 9 additions & 0 deletions test/bin/common_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,12 @@ export BREW_EC_RELEASE_VERSION
# Set the release type to ec, rc or zstream
LATEST_RELEASE_TYPE="rc"
export LATEST_RELEASE_TYPE

BREW_LREL_RELEASE_VERSION="${BREW_EC_RELEASE_VERSION}"
export BREW_LREL_RELEASE_VERSION

# Branch and commit for the openshift-tests-private repository
OPENSHIFT_TESTS_PRIVATE_REPO_BRANCH="release-4.${MINOR_VERSION}"
OPENSHIFT_TESTS_PRIVATE_REPO_COMMIT="b6418066dc1c0fc55f8d0213792041770a0baf80"
export OPENSHIFT_TESTS_PRIVATE_REPO_BRANCH
export OPENSHIFT_TESTS_PRIVATE_REPO_COMMIT
74 changes: 65 additions & 9 deletions test/bin/scenario.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ SKIP_GREENBOOT=${SKIP_GREENBOOT:-false} # may be overridden in scenario file
IMAGE_SIGSTORE_ENABLED=false # may be overridden in scenario file
VNC_CONSOLE=${VNC_CONSOLE:-false} # may be overridden in global settings file
TEST_RANDOMIZATION="all" # may be overridden in scenario file
TEST_EXCLUDES="none" # may be overridden in scenario file
TEST_EXECUTION_TIMEOUT="30m" # may be overriden in scenario file
SUBSCRIPTION_MANAGER_PLUGIN="${SUBSCRIPTION_MANAGER_PLUGIN:-${SCRIPTDIR}/subscription_manager_register.sh}" # may be overridden in global settings file
RUN_HOST_OVERRIDE="" # target any given VM for running scenarios
Expand Down Expand Up @@ -1064,6 +1065,7 @@ EOF
if ! ${timeout_robot} \
--name "${SCENARIO}" \
--randomize "${TEST_RANDOMIZATION}" \
--exclude "${TEST_EXCLUDES}" \
--loglevel TRACE \
--listener "${TESTDIR}/resources/sos-on-failure-listener.py" \
--pythonpath "${TESTDIR}/resources" \
Expand Down Expand Up @@ -1137,7 +1139,7 @@ run_gingko_tests() {
local -r filter_pattern="$1"
echo "Applying filter: ${filter_pattern}"
if [[ "${filter_pattern}" == ~* ]]; then
sed -i "/${filter_pattern#~}/d" "${case_selected}"
sed -i "/${filter_pattern#\~}/d" "${case_selected}"
else
sed -i -n "/${filter_pattern}/p" "${case_selected}"
fi
Expand All @@ -1150,20 +1152,74 @@ run_gingko_tests() {
cat "${case_selected}"
echo "-----------------------------------------------------"

# Run the tests and capture output
if ! "${GINKGO_TEST_BINARY}" run --timeout 60m --junit-dir="${test_results_dir}" -f "${case_selected}" 2>&1 | tee "${test_results_dir}/test-output.log"; then
record_junit "${vmname}" "run_gingko_tests" "FAILED"
return 1
# Make sure the test execution times out after a predefined period.
# The 'timeout' command sends the HUP signal and, if the test does not
# exit after 5m, it sends the KILL signal to terminate the process.
local timeout_ginkgo="timeout -v --kill-after=5m ${TEST_EXECUTION_TIMEOUT} ${GINKGO_TEST_BINARY}"
if [ -t 0 ]; then
# Disable timeout for interactive mode when stdin is a terminal.
# This is necessary for proper handling of test interruption by user.
# shellcheck disable=SC2034
timeout_ginkgo="${GINKGO_TEST_BINARY}"
fi

record_junit "${vmname}" "run_gingko_tests" "OK"
# Run the tests and capture output with 10m timeout for every test case
echo "Gingko test execution started..."
ginkgo_result_success=true
if ! eval '${timeout_ginkgo} run --timeout 10m --junit-dir=${test_results_dir} -f ${case_selected}' 2>&1 | tee "${test_results_dir}/test-output.log"; then
if [ $? -ge 124 ] ; then
record_junit "${vmname}" "run_test_timed_out_${TEST_EXECUTION_TIMEOUT}" "FAILED"
fi
ginkgo_result_success=false
fi
echo "Gingko test execution completed"
popd &>/dev/null

# Clean the JUnit XML files
echo "Cleaning JUnit XML files to remove 'Monitor cluster while tests execute' test case"
cleanup_success=true
if [[ ! -f "${HANDLERESULT_SCRIPT}" ]]; then
echo "Warning: ${HANDLERESULT_SCRIPT} not found. Skipping XML cleanup."
else
for junit_file in "${test_results_dir}"/junit_e2e_*.xml; do
if [[ -f "${junit_file}" ]]; then
filename=$(basename "${junit_file}")
echo "Processing: ${filename}"

# Create backup
cp "${junit_file}" "${junit_file}.backup"

# Clean the XML
temp_file="${junit_file}.tmp"
if python3 "${HANDLERESULT_SCRIPT}" -a replace -i "${junit_file}" -o "${temp_file}" 2>/dev/null; then
mv "${temp_file}" "${junit_file}"
echo "✓ Cleaned: ${filename}"
rm "${junit_file}.backup" # Remove backup on success
else
echo "✗ Failed to clean: ${filename} (restored from backup)"
mv "${junit_file}.backup" "${junit_file}" # Restore from backup
cleanup_success=false
fi
fi
done
fi

# Display results summary
echo "Gingko test execution completed"
echo "Results are available in: ${test_results_dir}"
if [[ -f "${test_results_dir}/test-output.log" ]]; then
echo "Test output log: ${test_results_dir}/test-output.log"
if [[ "${cleanup_success}" == "true" ]]; then
echo "Unit XML files have been cleaned ('Monitor cluster while tests execute' test case removed)"
record_junit "${vmname}" "clean_junit_xml_files" "OK"
else
echo "Some XML files could not be cleaned (originals preserved)"
record_junit "${vmname}" "clean_junit_xml_files" "FAILED"
fi

# Record the junit result of the ginkgo tests
if [[ "${ginkgo_result_success}" == "true" ]]; then
record_junit "${vmname}" "run_gingko_tests" "OK"
else
record_junit "${vmname}" "run_gingko_tests" "FAILED"
exit 1
fi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
firewall-offline-cmd --zone=public --add-port=443/tcp && \
firewall-offline-cmd --zone=public --add-port=5353/udp && \
firewall-offline-cmd --zone=public --add-port=6443/tcp && \
firewall-offline-cmd --zone=public --add-port=8889/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/udp
# {{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,24 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
firewall-offline-cmd --zone=public --add-port=443/tcp && \
firewall-offline-cmd --zone=public --add-port=5353/udp && \
firewall-offline-cmd --zone=public --add-port=6443/tcp && \
firewall-offline-cmd --zone=public --add-port=8889/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/udp

# Prepare system for testing Generic Device Plugin
COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
# Prepare system for testing Generic Device Plugin.
# Upgrade the kernel to keep the same procedure with RHEL and CentOS.
# CentOS requires upgrade because of a different package retention policy
# which means that the kernel in the base bootc image might no longer
# be available in the repositories.
# hadolint ignore=DL3003
RUN dnf upgrade kernel -y && \
KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)"; \
dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
dnf clean all && \
git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
cd /tmp/serialsim && \
make KERNEL="${KERNEL_VER_ARCH}" all install && \
rm -rf /tmp/serialsim

# {{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,23 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
firewall-offline-cmd --zone=public --add-port=443/tcp && \
firewall-offline-cmd --zone=public --add-port=5353/udp && \
firewall-offline-cmd --zone=public --add-port=6443/tcp && \
firewall-offline-cmd --zone=public --add-port=8889/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/udp

# Prepare system for testing Generic Device Plugin
COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
# Prepare system for testing Generic Device Plugin.
# Upgrade the kernel to keep the same procedure with RHEL and CentOS.
# CentOS requires upgrade because of a different package retention policy
# which means that the kernel in the base bootc image might no longer
# be available in the repositories.
# hadolint ignore=DL3003
RUN dnf upgrade kernel -y && \
KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)"; \
dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
dnf clean all && \
git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
cd /tmp/serialsim && \
make KERNEL="${KERNEL_VER_ARCH}" all install && \
rm -rf /tmp/serialsim
# {{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
firewall-offline-cmd --zone=public --add-port=443/tcp && \
firewall-offline-cmd --zone=public --add-port=5353/udp && \
firewall-offline-cmd --zone=public --add-port=6443/tcp && \
firewall-offline-cmd --zone=public --add-port=8889/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/udp
# {{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,24 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
firewall-offline-cmd --zone=public --add-port=443/tcp && \
firewall-offline-cmd --zone=public --add-port=5353/udp && \
firewall-offline-cmd --zone=public --add-port=6443/tcp && \
firewall-offline-cmd --zone=public --add-port=8889/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
firewall-offline-cmd --zone=public --add-port=30000-32767/udp

# Prepare system for testing Generic Device Plugin
COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
# Prepare system for testing Generic Device Plugin.
# Upgrade the kernel to keep the same procedure with RHEL and CentOS.
# CentOS requires upgrade because of a different package retention policy
# which means that the kernel in the base bootc image might no longer
# be available in the repositories.
# hadolint ignore=DL3003
RUN dnf upgrade kernel -y && \
KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)"; \
dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
dnf clean all && \
git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
cd /tmp/serialsim && \
make KERNEL="${KERNEL_VER_ARCH}" all install && \
rm -rf /tmp/serialsim

# {{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ports = [
"443:tcp",
"5353:udp",
"6443:tcp",
"8889:tcp",
"30000-32767:tcp",
"30000-32767:udp",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ ports = [
"443:tcp",
"5353:udp",
"6443:tcp",
"8889:tcp",
"30000-32767:tcp",
"30000-32767:udp",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ version = "{{ env.Getenv "BREW_EC_RELEASE_VERSION" }}"
name = "microshift-test-agent"
version = "*"

[[packages]]
name = "systemd-resolved"
version = "*"

[customizations.services]
enabled = ["microshift", "microshift-test-agent"]

Expand All @@ -53,6 +57,7 @@ ports = [
"443:tcp",
"5353:udp",
"6443:tcp",
"8889:tcp",
"30000-32767:tcp",
"30000-32767:udp",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ version = "{{ env.Getenv "BREW_RC_RELEASE_VERSION" }}"
name = "microshift-test-agent"
version = "*"

[[packages]]
name = "systemd-resolved"
version = "*"

[customizations.services]
enabled = ["microshift", "microshift-test-agent"]

Expand All @@ -53,6 +57,7 @@ ports = [
"443:tcp",
"5353:udp",
"6443:tcp",
"8889:tcp",
"30000-32767:tcp",
"30000-32767:udp",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ version = "{{ env.Getenv "BREW_Y0_RELEASE_VERSION" }}"
name = "microshift-test-agent"
version = "*"

[[packages]]
name = "systemd-resolved"
version = "*"

[customizations.services]
enabled = ["microshift", "microshift-test-agent"]

Expand All @@ -53,6 +57,7 @@ ports = [
"443:tcp",
"5353:udp",
"6443:tcp",
"8889:tcp",
"30000-32767:tcp",
"30000-32767:udp",
]
Expand Down
Loading