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 730b0dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion inspec/a2-iam-v2-integration/controls/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.reject{ |p| /^\[Legacy\]/.match(p[:name]) }

# default policies automatically added during migration
expect(other_policies.length).to eq 4
expect(other_policies.length).to be >= 4
end

it 'the editors default policy includes editor role' do
Expand Down
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 730b0dd

Please sign in to comment.