Skip to content

Commit

Permalink
Add tests and documentation to the package_tags system
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinHebert committed Dec 30, 2014
1 parent 3b831c7 commit 8aa47f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ This provider exposes quite a few provider-specific configuration options:
* `subnet_id` - The subnet to boot the instance into, for VPC.
* `associate_public_ip` - If true, will associate a public IP address to an instance in a VPC.
* `tags` - A hash of tags to set on the machine.
* `package_tags` - A hash of tags to set on the ami generated during the package operation.
* `use_iam_profile` - If true, will use [IAM profiles](http://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
for credentials.
* `block_device_mapping` - Amazon EC2 Block Device Mapping Property
Expand Down
11 changes: 9 additions & 2 deletions spec/vagrant-aws/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
its("iam_instance_profile_arn") { should be_nil }
its("iam_instance_profile_name") { should be_nil }
its("tags") { should == {} }
its("package_tags") { should == {} }
its("user_data") { should be_nil }
its("use_iam_profile") { should be_false }
its("block_device_mapping") {should == [] }
Expand All @@ -50,8 +51,8 @@
[:access_key_id, :ami, :availability_zone, :instance_ready_timeout,
:instance_package_timeout, :instance_type, :keypair_name, :ssh_host_attribute,
:ebs_optimized, :region, :secret_access_key, :session_token, :monitoring,
:associate_public_ip, :subnet_id, :tags, :elastic_ip, :terminate_on_shutdown,
:iam_instance_profile_arn, :iam_instance_profile_name,
:associate_public_ip, :subnet_id, :tags, :package_tags :elastic_ip,
:terminate_on_shutdown, :iam_instance_profile_arn, :iam_instance_profile_name,
:use_iam_profile, :user_data, :block_device_mapping].each do |attribute|

it "should not default #{attribute} if overridden" do
Expand Down Expand Up @@ -209,6 +210,8 @@ def set_test_values(instance)
it "should merge the tags and block_device_mappings" do
first.tags["one"] = "one"
second.tags["two"] = "two"
first.package_tags["three"] = "three"
second.package_tags["four"] = "four"
first.block_device_mapping = [{:one => "one"}]
second.block_device_mapping = [{:two => "two"}]

Expand All @@ -217,6 +220,10 @@ def set_test_values(instance)
"one" => "one",
"two" => "two"
}
third.package_tags.should == {
"three" => "three",
"four" => "four"
}
third.block_device_mapping.index({:one => "one"}).should_not be_nil
third.block_device_mapping.index({:two => "two"}).should_not be_nil
end
Expand Down

0 comments on commit 8aa47f3

Please sign in to comment.