Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Fix spuriously-failing end-to-end test #7103

Merged
merged 3 commits into from Oct 24, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .expeditor/scripts/end_to_end/run_e2e_test.ps1
@@ -1,5 +1,5 @@
param (
[string]$Channel="DEV",
[string]$Channel="dev",
[string]$TestName
)

Expand Down
2 changes: 1 addition & 1 deletion .expeditor/scripts/end_to_end/setup_environment.sh
Expand Up @@ -6,7 +6,7 @@ source .expeditor/scripts/shared.sh

# `channel` should be channel we are pulling from
#
# e.g. `DEV`, `ACCEPTANCE` etc.
# e.g. `dev`, `acceptance` etc.
channel=${1:?You must specify a channel value}

declare -g hab_binary
Expand Down
1 change: 0 additions & 1 deletion .expeditor/scripts/promote.sh
Expand Up @@ -29,7 +29,6 @@ source_environment=${1:?You must provide an Expeditor environment}
destination_channel=${2:?You must specify a destination channel value}

export HAB_AUTH_TOKEN="${ACCEPTANCE_HAB_AUTH_TOKEN}"
export HAB_BLDR_URL="${ACCEPTANCE_HAB_BLDR_URL}"

########################################################################

Expand Down
4 changes: 2 additions & 2 deletions e2e_env
Expand Up @@ -5,6 +5,6 @@
HAB_BLDR_URL=https://bldr.acceptance.habitat.sh
BUILD_PKG_TARGET=x86_64-linux
HAB_ORIGIN=core
HAB_BLDR_CHANNEL=DEV
HAB_INTERNAL_BLDR_CHANNEL=DEV
HAB_BLDR_CHANNEL=dev
HAB_INTERNAL_BLDR_CHANNEL=dev
HAB_LICENSE=accept-no-persist
2 changes: 1 addition & 1 deletion e2e_local.sh
Expand Up @@ -22,7 +22,7 @@ fi
# Note that the `ci-studio-common.sh` file is baked into the image we
# use.
commands=(". /opt/ci-studio-common/buildkite-agent-hooks/ci-studio-common.sh"
".expeditor/scripts/end_to_end/setup_environment.sh DEV"
".expeditor/scripts/end_to_end/setup_environment.sh dev"
"hab pkg install --binlink --channel=stable core/expect"
"${*}")

Expand Down
Expand Up @@ -17,6 +17,15 @@ export HAB_FEAT_BOOT_FAIL=1
export HAB_LAUNCH_NO_SUP_VERSION_CHECK="true"
sup_log=$(mktemp)

# Preinstall these packages. If we don't, then we spend the bulk of
# our time in the following `while` loop downloading them, rather than
# actually exercising the functionality we're after. That leads to
# spurious failures, depending on how long the downloading takes.
#
# Doing things this way, we eliminate that concern.
hab pkg install core/hab-sup --channel="${HAB_BLDR_CHANNEL}"
hab pkg install core/hab-launcher --channel="${HAB_BLDR_CHANNEL}"

echo -n "Starting launcher (logging to $sup_log)..."
hab sup run &> "$sup_log" &
launcher_pid=$!
Expand All @@ -25,24 +34,34 @@ trap 'pgrep hab-launch &>/dev/null && pkill -9 hab-launch' INT TERM EXIT
retries=0
max_retries=5
while ps -p "$launcher_pid" &>/dev/null; do
echo -n .
if [[ $((retries++)) -gt $max_retries ]]; then
echo
echo "Failure! Launcher failed to exit before timeout"
contents=$(cat "$sup_log")
echo "--- FAILURE LOG: ${contents}"
exit 2
else
sleep 1
contents=$(cat "$sup_log")
echo "--- LOG: ${contents}"
fi
echo -n .
if [[ $((retries++)) -gt $max_retries ]]; then
echo
echo "Failure! Launcher failed to exit before timeout"
contents=$(cat "$sup_log")
echo "--- FAILURE LOG: ${contents}"
exit 2
else
sleep 1
fi
done

echo

if wait "$launcher_pid"; then
echo "Failure! Launcher exited success; error expected"
echo "Failure! Launcher exited success; error expected"
else
echo "Success! Launcher exited with error"
expected_error_string="Unable to accept connection from Supervisor"
contents=$(cat "$sup_log")
if [[ "${contents}" =~ ${expected_error_string} ]]; then
echo "Success! Launcher exited with expected error: ${expected_error_string}"
else
echo "--- FAILURE! Launcher exited with an error, but not the expected one!"
echo "Did not find:"
echo " ${expected_error_string}"
echo "in the output (see full output below)!"
echo
echo "${contents}"
exit 3
fi
fi