blob: d38f441cacab7ca35841f573c27527a3f4ffc47e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
require File.expand_path('../test_helper', __FILE__)
class ConfigObjectListTest < MiniTest::Unit::TestCase
def test_node_search
nodes = manager.nodes['name' => 'vpn1']
assert_equal 1, nodes.size
assert_equal 'vpn1', nodes.values.first.name
end
def test_complex_node_search
domain = provider.domain
nodes = manager.nodes['x509.use' => true]
assert nodes.size != manager.nodes.size, 'should not return all nodes'
assert nodes.size > 2, 'should be some nodes'
expected = manager.nodes.collect {|name, node|
if node.x509.use
node.domain.full
end
}.compact
assert_equal expected.size, nodes.size
assert_equal expected.sort, nodes.field('domain.full').sort
end
def test_nodes_like_me
nodes = manager.nodes[:environment => nil]
node = nodes.values.first
assert nodes.size > 1, "should be nodes with no environment set"
assert_equal node.nodes_like_me.values, nodes.values
nodes = manager.nodes[:environment => "production"]
node = nodes.values.first
assert nodes.size > 1, "should be production nodes"
assert_equal node.nodes_like_me.values, nodes.values
end
end
|