No commit activity in last 3 years
No release in over 3 years
PgSQL plugin for Infrataster
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
~> 3.0

Runtime

~> 0.2.0
~> 0.17
 Project Readme

infrataster-plugin-pgsql

PgSQL plugin for Infrataster

Pre-requisite

  1. postgresql-libs and postgresql-devel should be installed

Installation

Install infrataster-plugin-pgsql by following command

$ gem install infrataster-plugin-pgsql

Add this line to your Gemfile:

gem 'infrataster-plugin-pgsql'

And then add the following line to your spec_helper.rb:

require 'infrataster-plugin-pgsql'

Usage

describe server(:db) do
  describe pgsql_query('SELECT * from pg_stat_activity') do
    it 'should allowed connection' do
      connection.status.should == PG::CONNECTION_OK
    end
    it 'should show database name' do
      row = result.find{|r| r['usename'] == 'postgres'}
      expect(row['datname']).to be == 'postgres'
    end
  end
end

describe server(:dbtest) do
  describe pgsql_query('SHOW PORT') do
    it 'connection refused' do 
      expect { connection.status }.to raise_error( PG::ConnectionBad, /could not connect to server: Connection refused/ )
    end
  end
end

You can specify username and password by options passed to Infrataster::Server.define in spec_helper.rb:

Infrataster::Server.define(
  :db,
  '172.26.126.70',
  pgsql: {user: 'postgres', password: 'postgres'},
  )

Contributing

  1. Fork it ( https://github.com/SnehaM/infrataster-plugin-pgsql/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request