github.com/go-chef/chef@v0.30.1/test_chef_server/test/integration/default/inspec/node_spec.rb (about)

     1  # Inspec tests for the container chef api go module
     2  #
     3  
     4  describe command('/go/src/github.com/go-chef/chef/testapi/bin/node') do
     5    its('stderr') { should_not match(/error|no such file|cannot find|not used|undefined/) }
     6    its('stderr') do
     7      should match(%r{^Couldn't recreate node node1.  POST https://testhost/organizations/test/nodes: 409})
     8    end
     9    its('stderr') { should match(/^Couldn't recreate node node1.  409/) }
    10    its('stdout') { should match(/^List initial nodes map\[\]$/) }
    11    its('stdout') { should match(/^Define node1 {Name:node11.0 Environment:_default.*Chef::Node RunList:\[pwn\]/) }
    12    its('stdout') { should match(%r{^Added node1 &\{https://testhost/organizations/test/nodes/node11.0\}}) }
    13    its('stdout') do
    14      should match(%r{^List nodes after adding node1 map\[node11.0:https://testhost/organizations/test/nodes/node11.0\]})
    15    end
    16    its('stdout') do
    17      should match(/^Get node1 {Name:node11.0 Environment:_default ChefType:node AutomaticAttributes:map\[attr:value\] NormalAttributes:map\[\] DefaultAttributes:map\[\] OverrideAttributes:map\[\] JsonClass:Chef::Node RunList:\[recipe\[pwn\]\] PolicyName: PolicyGroup/)
    18    end
    19    its('stdout') { should match(/^Update node1/) }
    20    its('stdout') { should match(/^Get node1 after update/) }
    21    its('stdout') { should match(/^Delete node1 <nil>/) }
    22    its('stdout') { should match(/^List nodes after cleanup map\[\]/) }
    23    its('stdout') { should match(/^Head node node1: <nil>/) }
    24    its('stdout') { should match(/^Head node nothere: .*404/) }
    25  
    26    its('stderr') do
    27      should match(%r{^Couldn't recreate node node1.  POST https://testhost/organizations/test/nodes: 409})
    28    end
    29    its('stderr') { should match(/^Couldn't recreate node node1.  409/) }
    30    its('stdout') { should match(/^List initial nodes map\[\]$/) }
    31    its('stdout') { should match(/^Define node1 {Name:node11.3 Environment:_default.*Chef::Node RunList:\[pwn\]/) }
    32    its('stdout') { should match(%r{^Added node1 &\{https://testhost/organizations/test/nodes/node11.3\}}) }
    33    its('stdout') do
    34      should match(%r{^List nodes after adding node1 map\[node11.3:https://testhost/organizations/test/nodes/node11.3\]})
    35    end
    36    its('stdout') do
    37      should match(/^Get node1 {Name:node11.3 Environment:_default ChefType:node AutomaticAttributes:map\[attr:value\] NormalAttributes:map\[\] DefaultAttributes:map\[\] OverrideAttributes:map\[\] JsonClass:Chef::Node RunList:\[recipe\[pwn\]\] PolicyName: PolicyGroup/)
    38    end
    39    its('stdout') { should match(/^Update node1/) }
    40    its('stdout') { should match(/^Get node1 after update/) }
    41    its('stdout') { should match(/^Delete node1 <nil>/) }
    42    its('stdout') { should match(/^List nodes after cleanup map\[\]/) }
    43    its('stdout') { should match(/^Head node node1: <nil>/) }
    44    its('stdout') { should match(/^Head node nothere: .*404/) }
    45  end