2014-01-24 15:00:19 +00:00
|
|
|
# encoding: UTF-8
|
|
|
|
|
|
|
|
require_relative 'spec_helper'
|
|
|
|
require ::File.join ::File.dirname(__FILE__), '..', 'libraries', 'database'
|
2013-06-07 11:37:01 -07:00
|
|
|
|
|
|
|
describe ::Openstack do
|
|
|
|
before do
|
2013-12-09 13:20:16 -06:00
|
|
|
@chef_run = ::ChefSpec::Runner.new ::CHEFSPEC_OPTS
|
2014-01-24 15:00:19 +00:00
|
|
|
@chef_run.converge 'openstack-common::default'
|
2013-06-07 11:37:01 -07:00
|
|
|
@subject = ::Object.new.extend ::Openstack
|
|
|
|
@subject.stub :include_recipe
|
|
|
|
end
|
|
|
|
|
2014-01-24 15:00:19 +00:00
|
|
|
describe '#db_create_with_user' do
|
|
|
|
it 'returns nil when no such service was found' do
|
2013-06-07 11:37:01 -07:00
|
|
|
@subject.stub(:node).and_return @chef_run.node
|
2014-01-24 15:00:19 +00:00
|
|
|
@subject.db_create_with_user('nonexisting', 'user', 'pass').should be_nil
|
2013-06-07 11:37:01 -07:00
|
|
|
end
|
|
|
|
|
2014-01-24 15:00:19 +00:00
|
|
|
it 'returns db info and creates database with user when service found' do
|
2013-06-07 11:37:01 -07:00
|
|
|
@subject.stub(:database).and_return {}
|
|
|
|
@subject.stub(:database_user).and_return {}
|
|
|
|
@subject.stub(:node).and_return @chef_run.node
|
2014-01-24 15:00:19 +00:00
|
|
|
result = @subject.db_create_with_user 'compute', 'user', 'pass'
|
|
|
|
result['host'].should eq('127.0.0.1')
|
|
|
|
result['port'].should eq('3306')
|
2013-06-07 11:37:01 -07:00
|
|
|
end
|
|
|
|
|
2014-01-24 15:00:19 +00:00
|
|
|
it 'creates database' do
|
|
|
|
pending 'TODO: test this LWRP'
|
2013-06-07 11:37:01 -07:00
|
|
|
end
|
|
|
|
|
2014-01-24 15:00:19 +00:00
|
|
|
it 'creates database user' do
|
|
|
|
pending 'TODO: test this LWRP'
|
2013-06-07 11:37:01 -07:00
|
|
|
end
|
|
|
|
|
2014-01-24 15:00:19 +00:00
|
|
|
it 'grants privs to database user' do
|
|
|
|
pending 'TODO: test this LWRP'
|
2013-06-07 11:37:01 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|