C0 code coverage information generated on Wed Mar 15 10:52:01 MST 2006
Marked code looks like this.
This line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this.
Finally, here's a line marked as not executed.
1 #! /usr/bin/ruby
2
3 $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4 $:.unshift File.join(File.dirname(__FILE__), "..", "bin")
5
6 require 'kvmcheck'
7 require 'test/unit'
8
9 class TestKvm < Test::Unit::TestCase
10 def setup
11 @script = Script.new('examples/vpdbase.script')
12 @interfaces_header = [:id, :appliance_id, :port_num, :name, :conn_type, :conn_id]
13 @servers_header = [:id, :name, :type, :icon, :custom_field1, :custom_field2, :custom_field3, :browser_url, :description, :contact, :contact_phone, :comment]
14 @appliances_header = [:id, :name, :type, :product_id, :icon, :custom_field1, :custom_field2, :custom_field3, :address, :nmm, :amp, :snmp_read_com, :snmp_write_com, :description, :contact, :contact_phone, :comment, :browser_url]
15
16 @hosts = AllHosts.new('examples/equinix.psv')
17 @headers = [:datacenter_name, :rack_id, :reference_name, :host_name, :host_class_name, :netmask, :serial_number, :mac_addr, :ip, :interface_name, :make, :model, :power_bar_ip, :power_bar_port, :rack_unit, :ram, :disk1, :network_prefix, :prefix_mask, :network_partition, :network_type, :parent_host_class, :kvm_name, :kvm_port, :kvm_ip]
18 end
19
20 def teardown
21 end
22
23 def test_host
24 assert_equal(@headers, @hosts.parser.headers)
25 assert_equal(2090, @hosts.hosts.length)
26 assert_equal("psnt-000-001|?|?|?", @hosts.hosts[0].to_s)
27 assert_equal("psnt-000-019|?|?|?", @hosts.hosts[10].to_s)
28 assert_equal("pbsk-009-038|kvm 6|5|10.64.0.206", @hosts.hosts[2089].to_s)
29 end
30
31 def test_script
32 assert_equal(@interfaces_header, @script.interfaces_header)
33 assert_equal(@appliances_header, @script.appliances_header)
34 assert_equal(@servers_header, @script.servers_header)
35 assert_equal(1747, @script.host.length)
36 assert_equal("", @script.host[@hosts.hosts[0].host_name].to_s)
37 assert_equal("pakv-000-201|520290-0B11A4|16|10.64.0.201", @script.host[@hosts.hosts[100].host_name].to_s)
38 assert_equal("pakv-000-203|520290-0B1182|12|10.64.0.203", @script.host[@hosts.hosts[2025].host_name].to_s)
39
40 end
41
42 def test_missing
43 host = AllHosts::Host.new('pamn-000-047', 'kvm 6', '9', '10.64.0.206')
44 assert(!@script.has_host?(host))
45 assert(@hosts.has_kvm?(host))
46 end
47
48 end
49
50 # vim:ts=2:sw=2:sts=2:et

