Plugin to test and query redis server using infrataster
Redis plugin for Infrataster
Add this line to your Gemfile:
gem 'infrataster-plugin-redis'
And then add the following line to your spec_helper.rb:
require 'infrataster-plugin-redis'
describe server(:redisdb) do
describe redis("ping") do
it 'should ping server' do
# Ping redis
result.should == "PONG"
end
end
describe redis("set 'status', 'success'") do
it 'should set value' do
# Setting value in redis
result.should == "OK"
end
end
describe redis("get 'status'") do
it 'should get value' do
# Getting value from redis
result.should == 'success'
end
end
end
You can specify hostname, port number, db by options passed to Infrataster::Server.define
:
Infrataster::Server.define(
# ...
redis: {host: 'localhost', port: 6379, db: 15},
)
You can access password protected redis instance by specifying password in options passed to Infrataster::Server.define
:
Infrataster::Server.define(
# ...
redis: {host: 'localhost', port: 6379, db: 15, password: 'p4ssw0rd'}
)
You can also access the redis using URL Functionality
Infrataster::Server.define(
# ...
redis:{url: 'redis://localhost:6379/15'}
#redis:{url: 'redis://:p4ssw0rd@localhost:6379/15'}
)
- Fork it ( https://github.com/[my-github-username]/infrataster-plugin-redis/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request