github.com/go-chef/chef@v0.30.1/test_chef_server/test/integration/default/inspec/client_spec.rb (about) 1 # Inspec tests for the client chef api go module 2 # 3 4 describe command('/go/src/github.com/go-chef/chef/testapi/bin/client') do 5 its('stderr') do 6 should match(%r{^Couldn't recreate client client1. POST https://testhost/organizations/test/clients: 409}) 7 end 8 its('stderr') { should match(/^Couldn't recreate client client1. Code 409/) } 9 its('stderr') { should match(/^Couldn't recreate client client1. Msg Client already exists/) } 10 its('stderr') { should match(/^Couldn't recreate client client1. Text \{"error":\["Client already exists"\]\}/) } 11 its('stderr') { should_not match(/no such file|cannot find|not used|undefined/) } 12 its('stdout') { should match(/^List initial clients test-validator/) } 13 its('stdout') do 14 should match(/^Define client1 \{Name:client1 ClientName: Validator:false Admin:false CreateKey:true\}/) 15 end 16 its('stdout') do 17 should match(%r{^Added client1 &\{Uri:https://testhost/organizations/test/clients/client1 ChefKey:\{Name:default PublicKey:-----BEGIN PUBLIC KEY-----MIIB.*ExpirationDate:infinity Uri:.*PrivateKey:-----BEGIN RSA PRIVATE KEY}) 18 end 19 its('stdout') do 20 should match(%r{^Added client2 &\{Uri:https://testhost/organizations/test/clients/client2 ChefKey:\{Name: PublicKey: ExpirationDate: Uri: PrivateKey:\}\}}) 21 end 22 # TODO: are OrgName and Uri part of the get output 23 its('stdout') do 24 should match(/Get client1 \{Name:client1 ClientName:client1 OrgName:test Validator:false JsonClass:Chef::ApiClient ChefType:client\}/) 25 end 26 its('stdout') do 27 should match(/Get client2 \{Name:client2 ClientName:client2 OrgName:test Validator:true JsonClass:Chef::ApiClient ChefType:client\}/) 28 end 29 # TODO: are orgname and uri part of the output 30 its('stdout') do 31 should match(/Update client1 &\{Name:clientchanged ClientName:clientchanged OrgName: Validator:true JsonClass:Chef::ApiClient ChefType:client\}/) 32 end 33 its('stdout') do 34 should match(/Update client2 &\{Name:client2 ClientName:client2 OrgName: Validator:true JsonClass:Chef::ApiClient ChefType:client\}/) 35 end 36 its('stdout') { should match(/^Delete client1 <nil>/) } 37 its('stdout') { should match(/^Delete client2 <nil>/) } 38 its('stdout') { should match(/^List clients after cleanup test-validator/) } 39 end