/[pxelator]/lib/PXElator/t/client.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/t/client.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 313 by dpavlin, Thu Aug 27 18:59:12 2009 UTC revision 397 by dpavlin, Tue Sep 8 17:30:31 2009 UTC
# Line 4  use warnings; Line 4  use warnings;
4  use strict;  use strict;
5  use autodie;  use autodie;
6    
7  use Test::More tests => 15;  use Test::More tests => 20;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9  use English;  use English;
10    
# Line 13  use_ok 'client'; Line 13  use_ok 'client';
13  my $host = '127.0.0.1';  my $host = '127.0.0.1';
14  my $mac  = 'DE:AD:00:00:BE:EF';  my $mac  = 'DE:AD:00:00:BE:EF';
15    
16  my $dir = "$server::base_dir/conf/$server::ip";  my $dir = "$server::base_dir/conf";
17  system "sudo chown $UID $dir/ip $dir/mac";  system "sudo chown $UID $dir/ip $dir/mac";
18    
19  ok( client::conf( $host => 'test', default => 'default' ), 'conf default' );  ok( client::conf( $host => 'test', default => 'default' ), 'conf default' );
# Line 23  cmp_ok( client::conf( $host => 'test' ), Line 23  cmp_ok( client::conf( $host => 'test' ),
23    
24  ok( ! client::conf( $host => 'non-existing' ), 'conf non-existing' );  ok( ! client::conf( $host => 'non-existing' ), 'conf non-existing' );
25    
26    ok( client::remove( $host ), "remove $host" );
27    
28  ok( my $ip = client::next_ip( $mac ), 'next_ip' );  ok( my $ip = client::next_ip( $mac ), 'next_ip' );
29  diag $ip;  diag $ip;
30    
# Line 37  cmp_ok( $mac_from_ip, 'eq', $mac ); Line 39  cmp_ok( $mac_from_ip, 'eq', $mac );
39  ok( my $conf = client::all_conf( $ip ), 'all_conf' );  ok( my $conf = client::all_conf( $ip ), 'all_conf' );
40  diag dump $conf;  diag dump $conf;
41    
42  diag "cleanup";  ok( my @ips = client::all_ips(), 'all_ips' );
43  ok( unlink( $_ ), "unlink $_" ) foreach ( glob("$dir/ip/$host/*"), "$dir/mac/$mac" );  diag dump @ips;
44  ok( rmdir "$dir/ip/$host", 'rmdir' );  
45    ok( my $new_ip = client::change_ip( $ip, $host ), 'change_ip' );
46    ok( ! client::change_ip( $new_ip, $new_ip ), 'change_ip without change' );
47    ok( my $old_ip = client::change_ip( $new_ip, $ip ), 'change_ip back' );
48    cmp_ok( $old_ip, 'eq', $ip, 'ip back' );
49    
50    ok( client::arp_mac_dev(), 'arp_mac_dev' );
51    
52    ok( client::remove( $ip ), "remove $ip" );

Legend:
Removed from v.313  
changed lines
  Added in v.397

  ViewVC Help
Powered by ViewVC 1.1.26