recipe:
control_group "group" do
control "foo" do
it "should fail" do
expect(1).to eq(2)
end
end
endrecipe:
control_group "group" do
control "foo" do
it "should fail" do
expect(1).to eq(2)
end
end
end| [1] pry(#<Chef::Provisioning::AWSDriver::Driver>)> actual_elb.subnets | |
| => [<AWS::EC2::Subnet id:subnet-5bbda12f>, <AWS::EC2::Subnet id:subnet-eacb348f>, <AWS::EC2::Subnet id:subnet-fa1e21bc>] | |
| [2] pry(#<Chef::Provisioning::AWSDriver::Driver>)> actual_elb.availability_zones.to_a | |
| => [<AWS::EC2::AvailabilityZone name:us-west-2a>, <AWS::EC2::AvailabilityZone name:us-west-2c>, <AWS::EC2::AvailabilityZone name:us-west-2b>] | |
| [3] pry(#<Chef::Provisioning::AWSDriver::Driver>)> elb.client.detach_load_balancer_from_subnets(load_balancer_name: actual_elb.name, subnets: ['subnet-5bbda12f']) | |
| => {:subnets=>["subnet-fa1e21bc", "subnet-eacb348f"], :response_metadata=>{:request_id=>"1807c203-be20-11e4-b84f-7bbb914bda43"}} | |
| [4] pry(#<Chef::Provisioning::AWSDriver::Driver>)> actual_elb = load_balancer_for(lb_spec) | |
| => <AWS::ELB::LoadBalancer name:tyler-test-lb> | |
| [5] pry(#<Chef::Provisioning::AWSDriver::Driver>)> actual_elb.availability_zones.to_a | |
| => [<AWS::EC2::AvailabilityZone name:us-west-2a>, <AWS::EC2::AvailabilityZone name:us-wes |
Create the following folder structure in your cookbook:
test
└── integrationq
├── helpers
│ ├── serverspec
│ │ ├── shared_serverspec_tests
│ │ │ └── shared_tests2.rb
│ │ └── spec_helper.rb
example:
it "should have mysql service" do
expect(service("mysql")).to be_enabled
expect(service("mysql")).to be_running
endexample_data:
Two controls blocks cannot be named the same. Doing so will raise a compilation error as seen with the following code:
# cookbook: example
# recipe: default
controls "mysql audit" do
control "mysql package" do
it "should be installed" do
expect(package("mysql")).to be_installed.with_version("5.6")
end# cookbook: example
# recipe: mysql
controls "mysql audit" do
control "mysql package" do
it "should be installed" do
expect(package("mysql")).to be_installed.with_version("5.6")
end
end| module Chef::JSONable | |
| # Serialize this object as a hash | |
| def to_json(*a) | |
| Chef::JSONCompat.to_json(for_json, *a) | |
| end | |
| def for_json | |
| raise "You must define `for_json` in your JSONable class" | |
| # Alternatively, return self? | |
| end |
| class Chef | |
| class Knife | |
| module DataBagSecretOptions | |
| include Mixlib::CLI | |
| option :secret, | |
| :short => "-s SECRET", | |
| :long => "--secret ", | |
| :description => "The secret key to use to encrypt data bag item values", | |
| :proc => Proc.new { |s| Chef::Config[:knife][:secret] = s } |