abiquo-installer-tests 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -0
- data/Rakefile +24 -0
- data/bin/abiquo-installer-tests +89 -0
- data/tests/1.8.0/abiquo_ciab.rb +21 -0
- data/tests/1.8.0/abiquo_kvm.rb +25 -0
- data/tests/1.8.0/abiquo_lvmiscsi.rb +17 -0
- data/tests/1.8.0/abiquo_monolithic.rb +12 -0
- data/tests/1.8.0/abiquo_nfs_repository.rb +23 -0
- data/tests/1.8.0/abiquo_platform.rb +19 -0
- data/tests/1.8.0/abiquo_remote_services.rb +73 -0
- data/tests/1.8.0/abiquo_server.rb +42 -0
- data/tests/1.8.0/abiquo_v2v.rb +37 -0
- data/tests/1.8.0/abiquo_vbox.rb +27 -0
- data/tests/1.8.0/abiquo_xen.rb +27 -0
- data/tests/abiquo_postinst_test.rb +124 -0
- metadata +122 -0
data/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
PRE-REQUISITES
|
2
|
+
--------------
|
3
|
+
|
4
|
+
Install the following ruby gems:
|
5
|
+
|
6
|
+
term-ansicolor
|
7
|
+
iniparse
|
8
|
+
mixlib-cli
|
9
|
+
|
10
|
+
|
11
|
+
RUNNING THE TESTS
|
12
|
+
-----------------
|
13
|
+
|
14
|
+
./bin/abiquo-installer-tests --host abiquo-host-ip --user root --password secret
|
15
|
+
|
16
|
+
The tests connects to the target host using SSH, uploads the tests and run them in the target host.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
8
|
+
gem.version = '0.2'
|
9
|
+
gem.name = "abiquo-installer-tests"
|
10
|
+
gem.homepage = "http://github.com/abiquo/abiquo-installer-tests"
|
11
|
+
gem.license = "MIT"
|
12
|
+
gem.summary = %Q{Abiquo Installer Unit Tests}
|
13
|
+
gem.description = %Q{Tests and troubleshoot Abiquo installations}
|
14
|
+
gem.email = "srubio@abiquo.com"
|
15
|
+
gem.authors = ["Sergio Rubio"]
|
16
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
17
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
18
|
+
gem.add_runtime_dependency 'term-ansicolor', '>= 1.0'
|
19
|
+
gem.add_runtime_dependency 'iniparse', '>= 1.0'
|
20
|
+
gem.add_runtime_dependency 'mixlib-cli', '>= 1.2'
|
21
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
22
|
+
end
|
23
|
+
Jeweler::RubygemsDotOrgTasks.new
|
24
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'net/ssh'
|
4
|
+
require 'net/sftp'
|
5
|
+
require 'term/ansicolor'
|
6
|
+
require 'mixlib/cli'
|
7
|
+
|
8
|
+
class String
|
9
|
+
include Term::ANSIColor
|
10
|
+
end
|
11
|
+
|
12
|
+
class MyCLI
|
13
|
+
include Mixlib::CLI
|
14
|
+
|
15
|
+
option :user,
|
16
|
+
:short => '-u USER',
|
17
|
+
:long => "--user USEr",
|
18
|
+
:description => "SSH user to login with (Default root)",
|
19
|
+
:default => 'root'
|
20
|
+
|
21
|
+
option :password,
|
22
|
+
:short => '-p PASS',
|
23
|
+
:long => "--password PASS",
|
24
|
+
:description => "SSH password to login with"
|
25
|
+
|
26
|
+
option :host,
|
27
|
+
:long => "--host HOST",
|
28
|
+
:description => "Abiquo host IP to test"
|
29
|
+
|
30
|
+
option :help,
|
31
|
+
:short => "-h",
|
32
|
+
:long => "--help",
|
33
|
+
:description => "Show this message",
|
34
|
+
:on => :tail,
|
35
|
+
:boolean => true,
|
36
|
+
:show_options => true,
|
37
|
+
:exit => 0
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def required_option(cli, opt)
|
42
|
+
if cli.config[opt].nil?
|
43
|
+
$stderr.puts "\n#{opt.to_s} argument requied.\n\n"
|
44
|
+
$stderr.puts cli.opt_parser.help
|
45
|
+
exit 1
|
46
|
+
end
|
47
|
+
return cli.config[opt]
|
48
|
+
end
|
49
|
+
|
50
|
+
Log = Logger.new($stdout)
|
51
|
+
|
52
|
+
cli = MyCLI.new
|
53
|
+
cli.parse_options
|
54
|
+
|
55
|
+
required_option cli, :password
|
56
|
+
required_option cli, :host
|
57
|
+
|
58
|
+
TESTS_DIR = File.dirname(__FILE__) + '/../tests/'
|
59
|
+
|
60
|
+
begin
|
61
|
+
Net::SSH.start(cli.config[:host], 'root', :paranoid => false, :password => cli.config[:password]) do |ssh|
|
62
|
+
ssh.exec!("rm -rf /tmp/tests")
|
63
|
+
end
|
64
|
+
rescue Exception => e
|
65
|
+
$stderr.puts "Error cleaning previous tests in host #{cli.config[:host]}: #{e.message}"
|
66
|
+
exit 1
|
67
|
+
end
|
68
|
+
|
69
|
+
begin
|
70
|
+
Net::SFTP.start(cli.config[:host], 'root', :password => cli.config[:password], :paranoid => false) do |sftp|
|
71
|
+
sftp.upload! TESTS_DIR, '/tmp/tests/'
|
72
|
+
end
|
73
|
+
rescue Exception => e
|
74
|
+
$stderr.puts "Error uploading tests to host #{cli.config[:host]}: #{e.message}"
|
75
|
+
exit 1
|
76
|
+
end
|
77
|
+
|
78
|
+
begin
|
79
|
+
Net::SSH.start(cli.config[:host], 'root', :password => cli.config[:password], :paranoid => false) do |ssh|
|
80
|
+
output = ssh.exec!("cd /tmp/tests/ && ruby abiquo_postinst_test.rb")
|
81
|
+
if output =~ /Failure/m
|
82
|
+
puts "\n>>>>>> TEST FAILED! <<<<<<".bold.red
|
83
|
+
end
|
84
|
+
puts output
|
85
|
+
end
|
86
|
+
rescue Exception => e
|
87
|
+
$stderr.puts "Error running tests in remote host #{cli.config[:host]}: #{e.message}"
|
88
|
+
exit 1
|
89
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'abiquo_platform'
|
2
|
+
require 'abiquo_remote_services'
|
3
|
+
require 'abiquo_server'
|
4
|
+
require 'abiquo_v2v'
|
5
|
+
require 'abiquo_monolithic'
|
6
|
+
require 'abiquo_kvm'
|
7
|
+
require 'abiquo_lvmiscsi'
|
8
|
+
|
9
|
+
class AbiquoCIABTest < Test::Unit::TestCase
|
10
|
+
def test_lvm_tomcat_dir
|
11
|
+
assert File.directory? '/opt/abiquo/lvmiscsi/tomcat/'
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# overriding abiquo_platform test
|
16
|
+
# FW can be safely enabled in CIAB installs
|
17
|
+
#
|
18
|
+
def test_firewall_service_enabled
|
19
|
+
assert true
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class AbiquoKVMTest < Test::Unit::TestCase
|
2
|
+
|
3
|
+
def test_aim_running
|
4
|
+
assert !`ps aux|grep abiquo-aim`.strip.chomp.empty?
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_aim_service_enabled
|
8
|
+
assert ::TestUtils.service_on?('abiquo-aim')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_libvirtd_service_enabled
|
12
|
+
assert ::TestUtils.service_on?('libvirtd')
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_abiquo_aim_properties_file
|
16
|
+
assert File.exist? '/etc/abiquo-aim.ini'
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_nfs_mounted
|
20
|
+
if !::TestUtils.installer_profiles.include?('cloud-in-a-box')
|
21
|
+
assert !`mount|grep vm_repository`.strip.chomp.empty?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class AbiquoLVMISCSITest < Test::Unit::TestCase
|
2
|
+
|
3
|
+
def test_tomcat_running
|
4
|
+
assert !`ps aux|grep java|grep '/opt/abiquo/lvmiscsi/tomcat'`.strip.chomp.empty?
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_tomcat_enabled
|
8
|
+
assert ::TestUtils.service_on?('abiquo-lvmiscsi')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_firewall_service_enabled
|
12
|
+
unless ::TestUtils.installer_profiles.include? 'cloud-in-a-box'
|
13
|
+
assert !::TestUtils.service_on?('iptables')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'abiquo_platform'
|
2
|
+
require 'abiquo_remote_services'
|
3
|
+
require 'abiquo_server'
|
4
|
+
require 'abiquo_v2v'
|
5
|
+
|
6
|
+
class AbiquoMonolithicTest < Test::Unit::TestCase
|
7
|
+
def test_webapps
|
8
|
+
%w(am api bpm-async client-premium legal nodecollector ROOT server ssm virtualfactory vsm).each do |w|
|
9
|
+
assert(File.directory? "/opt/abiquo/tomcat/webapps/#{w}")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class NFSRepositoryTest < Test::Unit::TestCase
|
2
|
+
|
3
|
+
def test_abiquo_repository_file
|
4
|
+
assert File.exist? '/opt/vm_repository/.abiquo_repository'
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_exports_file
|
8
|
+
assert File.exist? '/etc/exports'
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_exports_file_contents
|
12
|
+
count = 0
|
13
|
+
File.read('/etc/exports').each_line do |l|
|
14
|
+
count += 1 if l =~ /\/opt\/vm_repository/
|
15
|
+
end
|
16
|
+
assert(count == 1)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_nfs_service_on
|
20
|
+
assert(::TestUtils.service_on? 'nfs')
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class AbiquoPlatformTest < Test::Unit::TestCase
|
2
|
+
|
3
|
+
def test_tomcat_running
|
4
|
+
assert !`ps aux|grep java|grep '/opt/abiquo/tomcat'`.strip.chomp.empty?
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_tomcat_enabled
|
8
|
+
assert ::TestUtils.service_on?('abiquo-tomcat')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_abiquo_dir
|
12
|
+
assert File.directory? '/opt/abiquo/tomcat'
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_firewall_service_enabled
|
16
|
+
assert !::TestUtils.service_on?('iptables')
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'abiquo_platform'
|
2
|
+
|
3
|
+
class AbiquoRemoteServicesTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_abiquo_properties_present
|
6
|
+
assert File.exist? '/opt/abiquo/config/abiquo.properties'
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_redis_running
|
10
|
+
assert !`ps aux|grep java|grep redis`.strip.chomp.empty?
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_nfs_mounted
|
14
|
+
if not ::TestUtils.installer_profiles.include?('abiquo-nfs-repository') and \
|
15
|
+
!::TestUtils.installer_profiles.include?('cloud-in-a-box')
|
16
|
+
assert !`mount|grep vm_repository`.strip.chomp.empty?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_dhcpd_enabled
|
21
|
+
assert ::TestUtils.service_on?('dhcpd')
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_am
|
25
|
+
assert ::TestUtils.web_service_ok?('/am/check')
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_vsm
|
29
|
+
assert ::TestUtils.web_service_ok?('/vsm/check')
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_nodecollector
|
33
|
+
assert ::TestUtils.web_service_ok?('/nodecollector/check')
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_ssm
|
37
|
+
assert ::TestUtils.web_service_ok?('/ssm/check')
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_virtualfactory
|
41
|
+
assert ::TestUtils.web_service_ok?('/virtualfactory/check')
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_abiquo_repository_file
|
45
|
+
assert File.exist? '/opt/vm_repository/.abiquo_repository'
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_properties
|
49
|
+
require 'iniparse'
|
50
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
51
|
+
assert !config['remote-services'].nil?
|
52
|
+
assert !config['remote-services']['abiquo.virtualfactory.hyperv.repositoryLocation'].nil?
|
53
|
+
assert !config['remote-services']['abiquo.rabbitmq.username'].nil?
|
54
|
+
assert !config['remote-services']['abiquo.rabbitmq.password'].nil?
|
55
|
+
assert !config['remote-services']['abiquo.rabbitmq.host'].nil?
|
56
|
+
assert !config['remote-services']['abiquo.rabbitmq.port'].nil?
|
57
|
+
assert !config['remote-services']['abiquo.appliancemanager.localRepositoryPath'].nil?
|
58
|
+
assert !config['remote-services']['abiquo.appliancemanager.repositoryLocation'].nil?
|
59
|
+
assert !config['remote-services']['abiquo.virtualfactory.xenserver.repositoryLocation'].nil?
|
60
|
+
assert !config['remote-services']['abiquo.virtualfactory.vmware.repositoryLocation'].nil?
|
61
|
+
assert !config['remote-services']['abiquo.virtualfactory.storagelink.user'].nil?
|
62
|
+
assert !config['remote-services']['abiquo.virtualfactory.storagelink.password'].nil?
|
63
|
+
assert !config['remote-services']['abiquo.virtualfactory.storagelink.address'].nil?
|
64
|
+
assert !config['remote-services']['abiquo.redis.port'].nil?
|
65
|
+
assert !config['remote-services']['abiquo.redis.host'].nil?
|
66
|
+
assert !config['remote-services']['abiquo.storagemanager.netapp.user'].nil?
|
67
|
+
assert !config['remote-services']['abiquo.storagemanager.netapp.password'].nil?
|
68
|
+
assert !config['remote-services']['abiquo.dvs.enabled'].nil?
|
69
|
+
assert !config['remote-services']['abiquo.dvs.vcenter.user'].nil?
|
70
|
+
assert !config['remote-services']['abiquo.dvs.vcenter.password'].nil?
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'abiquo_platform'
|
2
|
+
|
3
|
+
class AbiquoServerTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_abiquo_properties_present
|
6
|
+
assert File.exist? '/opt/abiquo/config/abiquo.properties'
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_mysql_schema_present
|
10
|
+
assert(`mysql -e 'show databases' 2>&1` =~ /kinton/m)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_mysql_running
|
14
|
+
assert !`service mysqld status|grep running`.strip.chomp.empty?
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_rabbit_running
|
18
|
+
assert !`ps aux|grep java|grep rabbitmq`.strip.chomp.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_server_ws
|
22
|
+
assert ::TestUtils.web_service_ok?('/server/messagebroker/amf')
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_properties
|
26
|
+
require 'iniparse'
|
27
|
+
config = IniParse.parse(File.read('/opt/abiquo/config/abiquo.properties'))
|
28
|
+
assert !config['server'].nil?
|
29
|
+
assert !config['server']['abiquo.server.sessionTimeout'].nil?
|
30
|
+
assert !config['server']['abiquo.server.mail.server'].nil?
|
31
|
+
assert !config['server']['abiquo.server.mail.user'].nil?
|
32
|
+
assert !config['server']['abiquo.server.mail.password'].nil?
|
33
|
+
assert !config['server']['abiquo.rabbitmq.username'].nil?
|
34
|
+
assert !config['server']['abiquo.rabbitmq.password'].nil?
|
35
|
+
assert !config['server']['abiquo.rabbitmq.host'].nil?
|
36
|
+
assert !config['server']['abiquo.rabbitmq.port'].nil?
|
37
|
+
assert !config['server']['abiquo.database.user'].nil?
|
38
|
+
assert !config['server']['abiquo.auth.module'].nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'abiquo_platform'
|
2
|
+
|
3
|
+
class AbiquoV2VTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_tomcat_running
|
6
|
+
assert !`ps aux|grep java|grep '/opt/abiquo/tomcat'`.strip.chomp.empty?
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_nfs_mounted
|
10
|
+
if (not ::TestUtils.installer_profiles.include?('abiquo-nfs-repository')) and \
|
11
|
+
(! ::TestUtils.installer_profiles.include?('cloud-in-a-box'))
|
12
|
+
assert !`mount|grep vm_repository`.strip.chomp.empty?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_abiquo_repository_file
|
17
|
+
assert File.exist? '/opt/vm_repository/.abiquo_repository'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_tomcat_enabled
|
21
|
+
assert ::TestUtils.service_on?('abiquo-tomcat')
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_v2v_context_present
|
25
|
+
assert File.directory? '/opt/abiquo/tomcat/webapps/bpm-async'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_v2v_scripts
|
29
|
+
assert File.exist?('/usr/bin/mechadora')
|
30
|
+
assert File.exist?('/usr/bin/v2v-diskmanager')
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_abiquo_dir
|
34
|
+
assert File.directory? '/opt/abiquo'
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class AbiquoVBoxTest < Test::Unit::TestCase
|
2
|
+
|
3
|
+
def test_aim_running
|
4
|
+
assert !`ps aux|grep abiquo-aim`.strip.chomp.empty?
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_aim_service_enabled
|
8
|
+
assert ::TestUtils.service_on?('abiquo-aim')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_libvirtd_service_enabled
|
12
|
+
assert ::TestUtils.service_on?('libvirtd')
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_firewall_service_enabled
|
16
|
+
assert !::TestUtils.service_on?('iptables')
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_abiquo_aim_properties_file
|
20
|
+
assert File.exist? '/etc/abiquo-aim.ini'
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_nfs_mounted
|
24
|
+
assert !`mount|grep vm_repository`.strip.chomp.empty?
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class AbiquoXenTest < Test::Unit::TestCase
|
2
|
+
|
3
|
+
def test_aim_running
|
4
|
+
assert !`ps aux|grep abiquo-aim`.strip.chomp.empty?
|
5
|
+
end
|
6
|
+
|
7
|
+
def test_aim_service_enabled
|
8
|
+
assert ::TestUtils.service_on?('abiquo-aim')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_libvirtd_service_enabled
|
12
|
+
assert ::TestUtils.service_on?('libvirtd')
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_firewall_service_enabled
|
16
|
+
assert !::TestUtils.service_on?('iptables')
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_abiquo_aim_properties_file
|
20
|
+
assert File.exist? '/etc/abiquo-aim.ini'
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_nfs_mounted
|
24
|
+
assert !`mount|grep vm_repository`.strip.chomp.empty?
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'yaml'
|
4
|
+
require 'term/ansicolor'
|
5
|
+
require 'iniparse'
|
6
|
+
require 'net/http'
|
7
|
+
require 'uri'
|
8
|
+
|
9
|
+
class String
|
10
|
+
include Term::ANSIColor
|
11
|
+
end
|
12
|
+
|
13
|
+
class TestUtils
|
14
|
+
|
15
|
+
def self.installer_profiles
|
16
|
+
begin
|
17
|
+
buf = File.read '/etc/abiquo-installer'
|
18
|
+
buf =~ /Installed Profiles:(.*)$/
|
19
|
+
return eval $1.strip.chomp
|
20
|
+
rescue Exception
|
21
|
+
return nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.service_on?(service)
|
26
|
+
ENV['LANG'] = 'POSIX'
|
27
|
+
`/sbin/chkconfig --list #{service}` =~ /3:on/
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.web_service_ok?(path, host = 'localhost')
|
31
|
+
res = Net::HTTP.get_response URI.parse("http://#{host}/#{path}")
|
32
|
+
return res.is_a? Net::HTTPOK
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.abiquo_version
|
36
|
+
return nil if not File.exist?('/etc/abiquo-release')
|
37
|
+
buf = File.read '/etc/abiquo-release'
|
38
|
+
buf =~ /Version:\s*(([0-9]|\.)+).*$/
|
39
|
+
$1
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
class BaseTest < Test::Unit::TestCase
|
45
|
+
|
46
|
+
def test_etk_present
|
47
|
+
assert File.exist? '/usr/bin/abiquo-check-install'
|
48
|
+
assert File.exist? '/usr/bin/abicli'
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_installer_profiles_present
|
52
|
+
assert TestUtils.installer_profiles.is_a? Array
|
53
|
+
assert !TestUtils.installer_profiles.empty?
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_abiquo_installer_file
|
57
|
+
assert File.exist? '/etc/abiquo-installer'
|
58
|
+
end
|
59
|
+
def test_abiquo_release_file
|
60
|
+
assert File.exist? '/etc/abiquo-release'
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
if not File.exist? '/etc/abiquo-installer'
|
66
|
+
$stderr.puts ""
|
67
|
+
$stderr.puts "/etc/abiquo-installer file not found in the Abiquo host."
|
68
|
+
$stderr.puts "Can't continue testing :("
|
69
|
+
$stderr.puts ""
|
70
|
+
exit 1
|
71
|
+
else
|
72
|
+
|
73
|
+
version = TestUtils.abiquo_version
|
74
|
+
$: << version
|
75
|
+
if version.nil?
|
76
|
+
puts "Can't find Abiquo Version in /etc/abiquo-release"
|
77
|
+
exit 1
|
78
|
+
end
|
79
|
+
|
80
|
+
if not File.directory?(version)
|
81
|
+
puts "Can't find tests for Abiquo Version #{version}"
|
82
|
+
exit 1
|
83
|
+
end
|
84
|
+
|
85
|
+
puts "\n\n"
|
86
|
+
puts "Abiquo Installer Test Suite"
|
87
|
+
puts "---------------------------"
|
88
|
+
puts ""
|
89
|
+
if TestUtils.installer_profiles.include? 'abiquo-monolithic'
|
90
|
+
puts "Testing " + "ABIQUO MONOLITHIC".yellow.bold
|
91
|
+
load version + '/abiquo_monolithic.rb'
|
92
|
+
end
|
93
|
+
if TestUtils.installer_profiles.include? 'abiquo-nfs-repository'
|
94
|
+
puts "Testing " + "ABIQUO NFS REPOSITORY".yellow.bold
|
95
|
+
load version + '/abiquo_nfs_repository.rb'
|
96
|
+
end
|
97
|
+
if TestUtils.installer_profiles.include? 'abiquo-remote-services'
|
98
|
+
puts "Testing " + "ABIQUO REMOTE SERVICES".yellow.bold
|
99
|
+
load version + '/abiquo_remote_services.rb'
|
100
|
+
end
|
101
|
+
if TestUtils.installer_profiles.include? 'abiquo-server'
|
102
|
+
puts "Testing " + "ABIQUO SERVER".yellow.bold
|
103
|
+
load version + '/abiquo_server.rb'
|
104
|
+
end
|
105
|
+
if TestUtils.installer_profiles.include? 'abiquo-v2v'
|
106
|
+
puts "Testing " + "ABIQUO V2V".yellow.bold
|
107
|
+
load version + '/abiquo_v2v.rb'
|
108
|
+
end
|
109
|
+
if TestUtils.installer_profiles.include? 'abiquo-kvm'
|
110
|
+
puts "Testing " + "ABIQUO KVM".yellow.bold
|
111
|
+
load version + '/abiquo_kvm.rb'
|
112
|
+
end
|
113
|
+
if TestUtils.installer_profiles.include? 'abiquo-xen'
|
114
|
+
puts "Testing " + "ABIQUO XEN".yellow.bold
|
115
|
+
load version + '/abiquo_xen.rb'
|
116
|
+
end
|
117
|
+
if TestUtils.installer_profiles.include? 'cloud-in-a-box'
|
118
|
+
puts "Testing " + "ABIQUO CIAB".yellow.bold
|
119
|
+
load version + '/abiquo_ciab.rb'
|
120
|
+
end
|
121
|
+
|
122
|
+
puts "\n\n"
|
123
|
+
|
124
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: abiquo-installer-tests
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Sergio Rubio
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-07-08 00:00:00 Z
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: term-ansicolor
|
21
|
+
prerelease: false
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 15
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
version: "1.0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: iniparse
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 15
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 0
|
46
|
+
version: "1.0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: mixlib-cli
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 11
|
58
|
+
segments:
|
59
|
+
- 1
|
60
|
+
- 2
|
61
|
+
version: "1.2"
|
62
|
+
type: :runtime
|
63
|
+
version_requirements: *id003
|
64
|
+
description: Tests and troubleshoot Abiquo installations
|
65
|
+
email: srubio@abiquo.com
|
66
|
+
executables:
|
67
|
+
- abiquo-installer-tests
|
68
|
+
extensions: []
|
69
|
+
|
70
|
+
extra_rdoc_files:
|
71
|
+
- README.md
|
72
|
+
files:
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- bin/abiquo-installer-tests
|
76
|
+
- tests/1.8.0/abiquo_ciab.rb
|
77
|
+
- tests/1.8.0/abiquo_kvm.rb
|
78
|
+
- tests/1.8.0/abiquo_lvmiscsi.rb
|
79
|
+
- tests/1.8.0/abiquo_monolithic.rb
|
80
|
+
- tests/1.8.0/abiquo_nfs_repository.rb
|
81
|
+
- tests/1.8.0/abiquo_platform.rb
|
82
|
+
- tests/1.8.0/abiquo_remote_services.rb
|
83
|
+
- tests/1.8.0/abiquo_server.rb
|
84
|
+
- tests/1.8.0/abiquo_v2v.rb
|
85
|
+
- tests/1.8.0/abiquo_vbox.rb
|
86
|
+
- tests/1.8.0/abiquo_xen.rb
|
87
|
+
- tests/abiquo_postinst_test.rb
|
88
|
+
homepage: http://github.com/abiquo/abiquo-installer-tests
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
version: "0"
|
114
|
+
requirements: []
|
115
|
+
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.8.5
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Abiquo Installer Unit Tests
|
121
|
+
test_files: []
|
122
|
+
|