[pkg-kolab] r1396 - pkg-kolab_testsuite
Mathieu Parent
sathieu at alioth.debian.org
Sun Nov 15 14:28:49 UTC 2009
Author: sathieu
Date: 2009-11-15 14:28:48 +0000 (Sun, 15 Nov 2009)
New Revision: 1396
Modified:
pkg-kolab_testsuite/testsuite
Log:
testsuite:
- correctly create /etc/hosts
- one sub for each action
Modified: pkg-kolab_testsuite/testsuite
===================================================================
--- pkg-kolab_testsuite/testsuite 2009-11-15 13:56:55 UTC (rev 1395)
+++ pkg-kolab_testsuite/testsuite 2009-11-15 14:28:48 UTC (rev 1396)
@@ -104,6 +104,8 @@
my @domain_names;
my %test_domains;
+#=======================================================
+# Functions
#-------------------------------------------------------
sub initial_check
{
@@ -121,7 +123,24 @@
my $domname = shift;
return "192.168.0.".($domid+10);
}
+
#-------------------------------------------------------
+sub hosts_file
+{
+ my $hosts = "127.0.0.1 localhost\n";
+
+ for(my $domid = 0; $domid<=$config{'slave_count'}; $domid++) {
+ my $domname = "kolab_test_slave$domid";
+ $domname = "kolab_test_master" if $domid == 0;
+ my $domip = domain_ip($domid, $domname);
+ $hosts .= "$domip $domname.".$config{'dnsdomain'}." $domname\n";
+
+ }
+}
+
+#=======================================================
+# Actions
+#-------------------------------------------------------
sub domain_bootstrap
{
my $domid = shift;
@@ -324,6 +343,42 @@
}
#-------------------------------------------------------
+sub domain_install
+{
+ my $domid = shift;
+ my $domname = shift;
+ my $domip = domain_ip($domid, $domname);
+
+ #/etc/hosts file
+ my $hosts = hosts_file();
+ system("ssh -i '".$config{'storagepooldir'}."/key' root\@$domip 'cat <<EOF >> /etc/hosts
+$hosts
+EOF'");
+ #package repository
+ system("ssh -i '".$config{'storagepooldir'}."/key' root\@$domip 'cat <<EOF >> /etc/apt/sources.list
+#kolab
+deb http://pkg-kolab.alioth.debian.org/packages kolab-snapshots/
+EOF'");
+ system("ssh -i '".$config{'storagepooldir'}."/key' root\@$domip 'apt-get update'");
+ print "Nothing to do yet\n";
+ # follow https://wiki.kolab.org/index.php/Debian_-_Administrators_-_Kolab_Installation
+}
+
+#-------------------------------------------------------
+sub domain_test
+{
+ my $domid = shift;
+ my $domname = shift;
+
+ print "Nothing to do yet\n";
+ #apt-get install phpunit
+ #php /usr/share/php/tests/Kolab_Filter/Horde/Kolab/Filter/AllTests.php
+ #php /usr/share/php/tests/Kolab_FreeBusy/Horde/Kolab/FreeBusy/AllTests.php
+}
+
+#=======================================================
+# Main
+#-------------------------------------------------------
initial_check();
$vmm = Sys::Virt->new(address => $config{'virt_uri'});
@domains = $vmm->list_domains();
@@ -357,14 +412,11 @@
system("ssh-keygen -f '".$config{'storagepooldir'}."/key' -N ''");
}
- my $hosts = "127.0.0.1 localhost\n";
-
for(my $domid = 0; $domid<=$config{'slave_count'}; $domid++) {
my $domname = "kolab_test_slave$domid";
$domname = "kolab_test_master" if $domid == 0;
print "Action $action for domain $domname:\n";
my $domip = domain_ip($domid, $domname);
- $hosts .= "$domip $domname.".$config{'storagepooldir'}." $domname\n";
if ($action eq 'bootstrap') {
#Cleaning:
if($domname ~~ @domain_names) {
@@ -389,23 +441,9 @@
} elsif ($action eq 'boot') {
domain_boot($domid, $domname);
} elsif ($action eq 'install') {
- #/etc/hosts file
- system("ssh -i '".$config{'storagepooldir'}."/key' root\@$domip 'cat <<EOF >> /etc/hosts
-$hosts
-EOF'");
- #package repository
- system("ssh -i '".$config{'storagepooldir'}."/key' root\@$domip 'cat <<EOF >> /etc/apt/sources.list
-#kolab
-deb http://pkg-kolab.alioth.debian.org/packages kolab-snapshots/
-EOF'");
- system("ssh -i '".$config{'storagepooldir'}."/key' root\@$domip 'apt-get update'");
- print "Nothing to do yet\n";
- # follow https://wiki.kolab.org/index.php/Debian_-_Administrators_-_Kolab_Installation
+ domain_install($domid, $domname);
} elsif ($action eq 'test') {
- print "Nothing to do yet\n";
- #apt-get install phpunit
- #php /usr/share/php/tests/Kolab_Filter/Horde/Kolab/Filter/AllTests.php
- #php /usr/share/php/tests/Kolab_FreeBusy/Horde/Kolab/FreeBusy/AllTests.php
+ domain_test($domid, $domname);
} elsif ($action eq 'chroot') {
domain_chroot($domid, $domname);
} else {
More information about the pkg-kolab-devel
mailing list