Skip to content

Commit

Permalink
try a different means of purging stale connections
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel DeLeo <dan@chef.io>
  • Loading branch information
danielsdeleo committed Feb 21, 2020
1 parent 33b402a commit df2e8ff
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions integration/tests/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,31 @@ do_test_deploy() {
# The backend will timeout pg connections after 5 minutes, which will
# result in an EPIPE error in the services when they attempt to use the
# dead connection. The inspec tests can't handle this and don't have an
# easy retry mechanism, so we restart the frontends before running tests.
# easy retry mechanism, so we create some throwaway tokens to work through
# busted connections.
# Note that this disconnection isn't caused by automate-pg-gateway, which
# we have tuned to be more tolerant of idle connections.
# See also:
# * https://github.com/lib/pq/issues/870
# * https://github.com/lib/pq/pull/871
# * https://github.com/lib/pq/issues/939
docker exec -t "$_frontend1_container_name" "$cli_bin" restart-services
docker exec -t "$_frontend2_container_name" "$cli_bin" restart-services
docker exec -t "$_frontend1_container_name" "$cli_bin" iam token create --admin "$(date +%s)" || true
docker exec -t "$_frontend1_container_name" "$cli_bin" iam token create --admin "$(date +%s)" || true
docker exec -t "$_frontend2_container_name" "$cli_bin" iam token create --admin "$(date +%s)" || true
docker exec -t "$_frontend2_container_name" "$cli_bin" iam token create --admin "$(date +%s)" || true

run_inspec_tests "${A2_ROOT_DIR}" "a2-iam-v2-integration"
local admin_token
admin_token=$(docker exec -t "$_frontend1_container_name" \
"$cli_bin" iam token create --admin "diagnostics-test-$RANDOM")

docker exec -t "$_frontend1_container_name" \
"$cli_bin" diagnostics run --admin-token "$admin_token" "~iam-v1" "~applications"


docker exec -t "$_frontend2_container_name" \
"$cli_bin" diagnostics run --admin-token "$admin_token" "~iam-v1" "~applications"

run_inspec_tests "${A2_ROOT_DIR}" "a2-iam-v2-integration"

"$cli_bin" diagnostics run --admin-token "$admin_token" "~iam-v1" "~purge" "~cli" "~grpc" "~deployment" "~applications"

}
Expand Down

0 comments on commit df2e8ff

Please sign in to comment.