Use the aws_lambda
resource to test a specific lambda.
describe aws_lambda do
it { should exist}
its ('handler') { should eq 'main.on_event'}
its ('version') { should eq '$LATEST' }
its ('runtime') { should eq 'python3.7' }
end
This resource expects the name of the function.
describe aws_lambda('my_new_lambda') do
it { should exist}
its ('handler') { should eq 'main.on_event'}
its ('version') { should eq '$LATEST' }
its ('runtime') { should eq 'python3.7' }
end
}
Use the aws_lambdas
resource to test the collection of lambdas deployed into an account.
describe aws_lambdas do
its('count') { should eq 20 }
end
This resource does not expect any parameters.
Property | Description |
---|---|
names | The names of the lambda deployed. |
tags | The tags of the lambda deployed. |
lambdas = aws_lambdas()
describe lambdas do
its ('count') { should eq 33}
end
lambdas.tags.each_with_index { | tag, i |
if tag!= {} and tag.include? 'Application' and tag['Application']=='test')
lambda_name = lambdas.names[i]
describe aws_lambda(lambda_name) do
it { should exist}
its ('handler') { should eq 'main.on_event'}
its ('version') { should eq '$LATEST' }
its ('runtime') { should eq 'python3.7' }
end
end
}