]> git.proxmox.com Git - pve-container.git/commitdiff
add test case for centos6
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 5 May 2015 10:39:29 +0000 (12:39 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 5 May 2015 10:46:13 +0000 (12:46 +0200)
13 files changed:
src/PVE/LXCSetup/Redhat.pm
src/test/run_tests.pl
src/test/test-centos6-001/config [new file with mode: 0644]
src/test/test-centos6-001/etc/hosts.exp [new file with mode: 0644]
src/test/test-centos6-001/etc/init/start-ttys.conf.exp [new file with mode: 0644]
src/test/test-centos6-001/etc/init/tty.conf.exp [new file with mode: 0644]
src/test/test-centos6-001/etc/redhat-release [new file with mode: 0644]
src/test/test-centos6-001/etc/resolv.conf.exp [new file with mode: 0644]
src/test/test-centos6-001/etc/sysconfig/network [new file with mode: 0644]
src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth0.exp [new file with mode: 0644]
src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth1.exp [new file with mode: 0644]
src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth2.exp [new file with mode: 0644]
src/test/test-centos6-001/etc/sysconfig/network.exp [new file with mode: 0644]

index ccb1a82b17a5ab18241ce8b927168e21bd8d8b09..87c1720b0930573695b4e8fd7d13a50e6dd178c7 100644 (file)
@@ -133,7 +133,7 @@ sub set_hostname {
        PVE::Tools::file_set_contents($hostname_fn, "$hostname\n");
     } else {
        my $data = PVE::Tools::file_get_contents($sysconfig_network);
-       if ($data !~ s/^HOSTNAME=\s*(\S+)\s*$/HOSTNAME=$hostname/m) {
+       if ($data !~ s/^HOSTNAME=\s*(\S+)\s*$/HOSTNAME=$hostname\n/m) {
            $data .= "HOSTNAME=$hostname\n";
        }
        PVE::Tools::file_set_contents($sysconfig_network, $data);
index 3449538e899ea252428404acaa4e09df676f37b7..5cd37a1a185f0404d95b4aaa3dbcf558a38174d8 100755 (executable)
@@ -42,7 +42,7 @@ sub run_test {
        
        $lxc_setup->post_create_hook('$TEST$ABCDEF');
 
-       my @testfiles = qw(/etc/hostname /etc/hosts /etc/inittab /etc/network/interfaces /etc/resolv.conf /etc/passwd /etc/shadow);
+       my @testfiles = qw(/etc/hostname /etc/hosts /etc/inittab /etc/network/interfaces /etc/resolv.conf /etc/passwd /etc/shadow /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth2 /etc/sysconfig/network-scripts/ifcfg-eth3 /etc/init/start-ttys.conf /etc/init/tty.conf);
        foreach my $fn (@testfiles) {
            next if !-f "$testdir/$fn.exp";
            test_file("$testdir/$fn.exp", "$rootfs/$fn");
diff --git a/src/test/test-centos6-001/config b/src/test/test-centos6-001/config
new file mode 100644 (file)
index 0000000..73b98ff
--- /dev/null
@@ -0,0 +1,16 @@
+lxc.utsname = test1
+lxc.network.type = veth
+pve.network.bridge = vmbr0
+lxc.network.name = eth0
+lxc.network.veth.pair = veth100i0
+pve.network.ip = 1.2.3.4/24
+pve.network.gw = 1.2.3.1
+lxc.network.type = veth
+pve.network.bridge = vmbr0
+lxc.network.name = eth1
+lxc.network.veth.pair = veth100i1
+pve.network.ip = 10.2.3.4/24
+lxc.network.type = veth
+pve.network.bridge = vmbr0
+lxc.network.name = eth2
+lxc.network.veth.pair = veth100i2
diff --git a/src/test/test-centos6-001/etc/hosts.exp b/src/test/test-centos6-001/etc/hosts.exp
new file mode 100644 (file)
index 0000000..67c9944
--- /dev/null
@@ -0,0 +1,2 @@
+127.0.0.1 localhost.localnet localhost
+1.2.3.4 test1.promxox.com test1
diff --git a/src/test/test-centos6-001/etc/init/start-ttys.conf.exp b/src/test/test-centos6-001/etc/init/start-ttys.conf.exp
new file mode 100644 (file)
index 0000000..20e379b
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# This service starts the configured number of gettys.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file start-ttys.override and put your changes there.
+
+start on stopped rc RUNLEVEL=[2345]
+
+env ACTIVE_CONSOLES=/dev/tty[1-6]
+env X_TTY=/dev/tty1
+task
+script
+        . /etc/sysconfig/init
+        for tty in $(echo $ACTIVE_CONSOLES) ; do
+                [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
+                initctl start tty TTY=$tty
+        done
+end script
diff --git a/src/test/test-centos6-001/etc/init/tty.conf.exp b/src/test/test-centos6-001/etc/init/tty.conf.exp
new file mode 100644 (file)
index 0000000..0de48bc
--- /dev/null
@@ -0,0 +1,13 @@
+# tty - getty
+#
+# This service maintains a getty on the specified device.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file tty.override and put your changes there.
+
+stop on runlevel [S016]
+
+respawn
+instance $TTY
+exec /sbin/agetty -8 $TTY 38400
+usage 'tty TTY=/dev/ttyX  - where X is console id'
diff --git a/src/test/test-centos6-001/etc/redhat-release b/src/test/test-centos6-001/etc/redhat-release
new file mode 100644 (file)
index 0000000..cdb73e8
--- /dev/null
@@ -0,0 +1 @@
+CentOS release 6.3 (Final)
diff --git a/src/test/test-centos6-001/etc/resolv.conf.exp b/src/test/test-centos6-001/etc/resolv.conf.exp
new file mode 100644 (file)
index 0000000..d2e70a5
--- /dev/null
@@ -0,0 +1,3 @@
+search promxox.com
+nameserver 8.8.8.8
+nameserver 8.8.8.9
diff --git a/src/test/test-centos6-001/etc/sysconfig/network b/src/test/test-centos6-001/etc/sysconfig/network
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth0.exp b/src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth0.exp
new file mode 100644 (file)
index 0000000..2c5e570
--- /dev/null
@@ -0,0 +1,6 @@
+DEVICE=eth0
+ONBOOT=yes
+BOOTPROTO=none
+IPADDR=1.2.3.4
+NETMASK=255.255.255.0
+GATEWAY=1.2.3.1
diff --git a/src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth1.exp b/src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth1.exp
new file mode 100644 (file)
index 0000000..7be5df0
--- /dev/null
@@ -0,0 +1,5 @@
+DEVICE=eth1
+ONBOOT=yes
+BOOTPROTO=none
+IPADDR=10.2.3.4
+NETMASK=255.255.255.0
diff --git a/src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth2.exp b/src/test/test-centos6-001/etc/sysconfig/network-scripts/ifcfg-eth2.exp
new file mode 100644 (file)
index 0000000..72430ff
--- /dev/null
@@ -0,0 +1,3 @@
+DEVICE=eth2
+ONBOOT=yes
+BOOTPROTO=none
diff --git a/src/test/test-centos6-001/etc/sysconfig/network.exp b/src/test/test-centos6-001/etc/sysconfig/network.exp
new file mode 100644 (file)
index 0000000..11ec878
--- /dev/null
@@ -0,0 +1 @@
+HOSTNAME=test1