Skip to content

Commit b2d2f5d

Browse files
committed
Add a test for connecting to postgres with a pgpass file
Signed-off-by: Ben Abrams <me@benabrams.it>
1 parent 5190a43 commit b2d2f5d

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
55

66
## [Unreleased]
77

8+
### Added
9+
- tests for connecting with a pgpass file (@majormoses)
10+
811
## [1.4.5] - 2018-02-15
912
### Fixed
1013
- metric-postgres-graphite.rb: use the custom defined port when connecting to slave (@henkjan)

test/fixtures/bootstrap.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ source /etc/profile
1515
DATA_DIR=/tmp/kitchen/data
1616
RUBY_HOME=${MY_RUBY_HOME}
1717

18+
# setup a .pgpass file
19+
cat << EOF > /tmp/.pgpass
20+
*:5432:*:postgres:<REDACTED>
21+
EOF
22+
1823
# Start bootatraping
1924

2025
## install some required deps for pg_gem to install

test/integration/helpers/serverspec/check-postgres-alive-shared_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@
2323
its(:exit_status) { should eq 0 }
2424
its(:stdout) { should match(/CheckPostgres OK: Server version: {"version"=>"PostgreSQL/) }
2525
end
26+
27+
describe command("#{check} --hostname #{pg_host} --pgpass /tmp/.pgpass") do
28+
its(:exit_status) { should eq 0 }
29+
its(:stdout) { should match(/CheckPostgres OK: Server version: {"version"=>"PostgreSQL/) }
30+
end

0 commit comments

Comments
 (0)