/usr/share/pcsd/test/test_cluster.rb is in pcs 0.9.149-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | require 'test/unit'
require 'pcsd_test_utils.rb'
require 'cluster.rb'
class TestCluster < Test::Unit::TestCase
def test_empty
cluster = Cluster.new('test', [])
assert_equal('test', cluster.name)
assert_equal([], cluster.nodes)
assert_equal(0, cluster.num_nodes)
end
def test_nodes
cluster = Cluster.new('test', ['a', 'b'])
assert_equal('test', cluster.name)
assert_equal(['a', 'b'], cluster.nodes)
assert_equal(2, cluster.num_nodes)
cluster.nodes = ['x', 'y', 'z']
assert_equal('test', cluster.name)
assert_equal(['x', 'y', 'z'], cluster.nodes)
assert_equal(3, cluster.num_nodes)
end
def test_nodes_cleanup
cluster = Cluster.new('test', ['b', 'a'])
assert_equal('test', cluster.name)
assert_equal(['a', 'b'], cluster.nodes)
assert_equal(2, cluster.num_nodes)
cluster.nodes = ['z', 'x', 'y', 'z', 'x']
assert_equal('test', cluster.name)
assert_equal(['x', 'y', 'z'], cluster.nodes)
assert_equal(3, cluster.num_nodes)
end
def test_nodes_bad
cluster = Cluster.new('test', ['a', ['b', 'c'], 'd'])
assert_equal('test', cluster.name)
assert_equal(['a', 'd'], cluster.nodes)
assert_equal(2, cluster.num_nodes)
cluster.nodes = ['w', ['x'], 'y', [], 'z']
assert_equal('test', cluster.name)
assert_equal(['w', 'y', 'z'], cluster.nodes)
assert_equal(3, cluster.num_nodes)
end
end
|