Module: SearchNodeTests

Included in:
TestExplicitSearchDB, TestImplicitSearchDB
Defined in:
lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_search.rb

Instance Method Summary collapse

Instance Method Details

#test_list_nodesObject



193
194
195
196
197
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_search.rb', line 193

def test_list_nodes
  nodes = search(:node)
  assert_equal Chef::Node, nodes.first.class
  assert_equal 3, nodes.length
end

#test_search_node_with_attr_filterObject



209
210
211
212
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_search.rb', line 209

def test_search_node_with_attr_filter
  nodes = search(:node, "hostname:beta.example.com")
  assert_equal 1, nodes.length
end

#test_search_node_with_narrow_filterObject



204
205
206
207
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_search.rb', line 204

def test_search_node_with_narrow_filter
  nodes = search(:node, "role:beta_server")
  assert_equal 1, nodes.length
end

#test_search_node_with_wide_filterObject



199
200
201
202
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_search.rb', line 199

def test_search_node_with_wide_filter
  nodes = search(:node, "role:test_server AND chef_environment:default")
  assert_equal 2, nodes.length
end

#test_search_node_without_json_classObject



214
215
216
217
# File 'lib/knife-solo/resources/patch_cookbooks/chef-solo-search/tests/test_search.rb', line 214

def test_search_node_without_json_class
  nodes = search(:node, "chef_environment:default")
  assert_equal 3, nodes.length
end