File: networking_dns_02.t

package info (click to toggle)
systemconfigurator 2.0.10-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 724 kB
  • ctags: 313
  • sloc: perl: 7,423; makefile: 48
file content (61 lines) | stat: -rw-r--r-- 999 bytes parent folder | download | duplicates (4)
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
52
53
54
55
56
57
58
59
60
61
use Test;
use Data::Dumper;
use Carp;


#
#  This test verifies that /etc/resolv.conf is written (correctly) when DOMAINNAME
#  and NAMESERVER1 are both set
#

BEGIN {
    
    # Set up tests to run
    
    plan tests => 4;
    
    # Here is a trick to make it look like this was called with those args
    # on the command line before SystemConfig::Config runs.

    @ARGV = qw(--cfgfile t/cfg/networking_dns_02.cfg);
}

eval {
  use SCConfig;
  return 1;
};

ok($@,'') or croak("No point in going any further");

eval {
  use Network;
  return 1;
};

ok($@,'') or croak("No point in going any further");

# We loaded the file... now lets setup a fake directory to use

my $root = $config->root();

if(!$root) {
  croak("Running this not chroot is way too dangerous");
}

my $dir = $root . "/etc/";

system("mkdir -p $dir");

if(!-d $dir) {
    croak("No directory $dir exists");
}

Network::setup($config);

ok(! -e "$root/etc/resolv.conf");

#
# Now we cleanup
#

ok(system("rm -rf $root"),0);