Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Commit

Permalink
(MODULES-1702) Adds unit tests for RDS
Browse files Browse the repository at this point in the history
  • Loading branch information
petems committed Feb 8, 2015
1 parent 58f9be4 commit 8184af1
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
38 changes: 38 additions & 0 deletions spec/unit/provider/rds_instance/v2_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'spec_helper'

provider_class = Puppet::Type.type(:rds_instance).provider(:v2)

ENV['AWS_ACCESS_KEY_ID'] = 'redacted'
ENV['AWS_SECRET_ACCESS_KEY'] = 'redacted'
ENV['AWS_REGION'] = 'sa-east-1'

describe provider_class do

let(:resource) {
Puppet::Type.type(:rds_instance).new(
ensure: 'present',
name: 'awesome-db-5',
region: 'us-west-1',
db_name: 'mysqldbname3',
engine: 'mysql',
engine_version: '5.6.19a',
license_model: 'general-public-license',
allocated_storage: 10,
availability_zone_name: 'us-west-1a',
storage_type: 'gp2',
db_instance_class: 'db.m3.medium',
master_username: 'awsusername',
master_user_password: 'the-master-password',
multi_az: false,
)
}

let(:provider) { resource.provider }

let(:instance) { provider.class.instances.first }

it 'should be an instance of the ProviderV2' do
expect(provider).to be_an_instance_of Puppet::Type::Rds_instance::ProviderV2
end

end
41 changes: 41 additions & 0 deletions spec/unit/type/rds_instance_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'spec_helper'

type_class = Puppet::Type.type(:rds_instance)

describe type_class do

let :params do
[
:db_name,
]
end

let :properties do
[
:ensure,
:region,
:engine,
:engine_version,
:license_model,
:allocated_storage,
:availability_zone_name,
:storage_type,
:db_instance_class,
:master_username,
:master_user_password,
:multi_az,
]
end

it 'should have expected properties' do
properties.each do |property|
expect(type_class.properties.map(&:name)).to be_include(property)
end
end

it 'should have expected parameters' do
params.each do |param|
expect(type_class.parameters).to be_include(param)
end
end
end

0 comments on commit 8184af1

Please sign in to comment.