This repository has been archived by the owner on Jun 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(MODULES-1702) Adds unit tests for RDS
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |