summaryrefslogtreecommitdiffstats
path: root/config-db/t
diff options
context:
space:
mode:
authorOliver Tappe2008-01-07 15:58:13 +0100
committerOliver Tappe2008-01-07 15:58:13 +0100
commit175275655abd8a7a3db3c3a1dfc5ee49a6488307 (patch)
treec0ce7654c9d9228e8bb7ff472cd99364f3d40176 /config-db/t
parentmore refactoring (not limited to attribute handling) (diff)
downloadcore-175275655abd8a7a3db3c3a1dfc5ee49a6488307.tar.gz
core-175275655abd8a7a3db3c3a1dfc5ee49a6488307.tar.xz
core-175275655abd8a7a3db3c3a1dfc5ee49a6488307.zip
* finished refactoring of attribute handling code, especially the
merging of attributes, such that all tests are passed * tested and finished implementation of group support in slxconfig * added new class AttributeRoster which keeps track of the known attributes (the ones provided by the openslx core and any other ones that may have been added by some plugin). * added new option --list-attributes to slxconfig which shows information about all known attributes git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1444 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/t')
-rw-r--r--config-db/t/12-system.t27
-rw-r--r--config-db/t/13-client.t27
-rw-r--r--config-db/t/14-group.t27
-rw-r--r--config-db/t/25-attributes.t384
4 files changed, 274 insertions, 191 deletions
diff --git a/config-db/t/12-system.t b/config-db/t/12-system.t
index 7a3e5e1e..dc8670de 100644
--- a/config-db/t/12-system.t
+++ b/config-db/t/12-system.t
@@ -368,6 +368,33 @@ is($system1->{name}, q{SYS-'1'}, q{really got system named "SYS-'1'"});
# changing nothing at all should succeed
ok($configDB->changeSystem(1), 'changing nothing at all in system 1');
+# adding attributes should work
+$inSystem1->{attrs}->{slxgrp} = 'slxgrp1';
+$inSystem1->{attrs}->{vmware} = 'yes';
+ok($configDB->changeSystem(1, $inSystem1), 'adding attrs to system 1');
+$system1 = $configDB->fetchSystemByID(1);
+is($system1->{attrs}->{slxgrp}, 'slxgrp1', 'attr slxgrp has correct value');
+is($system1->{attrs}->{vmware}, 'yes', 'attr vmware has correct value');
+
+# changing an attribute should work
+$inSystem1->{attrs}->{vmware} = 'no';
+ok($configDB->changeSystem(1, $inSystem1), 'changing vmware in system 1');
+$system1 = $configDB->fetchSystemByID(1);
+is($system1->{attrs}->{slxgrp}, 'slxgrp1', 'attr slxgrp has correct value');
+is($system1->{attrs}->{vmware}, 'no', 'attr vmware has correct value');
+
+# deleting an attribute should remove it
+delete $inSystem1->{attrs}->{slxgrp};
+ok($configDB->changeSystem(1, $inSystem1), 'changing slxgrp in system 1');
+$system1 = $configDB->fetchSystemByID(1);
+ok(!exists $system1->{attrs}->{slxgrp}, 'attr slxgrp should be gone');
+
+# undef'ing an attribute should remove it, too
+$inSystem1->{attrs}->{vmware} = undef;
+ok($configDB->changeSystem(1, $inSystem1), 'undefining vmware in system 1');
+$system1 = $configDB->fetchSystemByID(1);
+ok(!exists $system1->{attrs}->{vmware}, 'attr vmware should be gone');
+
# changing a non-existing column should fail
ok(
! eval { $configDB->changeSystem(1, { xname => "xx" }) },
diff --git a/config-db/t/13-client.t b/config-db/t/13-client.t
index 5848ba53..1c8ea99f 100644
--- a/config-db/t/13-client.t
+++ b/config-db/t/13-client.t
@@ -357,6 +357,33 @@ is($client1->{name}, q{CLI-'1'}, q{really got client named "CLI-'1'"});
# changing nothing at all should succeed
ok($configDB->changeClient(1), 'changing nothing at all in client 1');
+# adding attributes should work
+$inClient1->{attrs}->{slxgrp} = 'slxgrp1';
+$inClient1->{attrs}->{vmware} = 'yes';
+ok($configDB->changeClient(1, $inClient1), 'adding attrs to client 1');
+$client1 = $configDB->fetchClientByID(1);
+is($client1->{attrs}->{slxgrp}, 'slxgrp1', 'attr slxgrp has correct value');
+is($client1->{attrs}->{vmware}, 'yes', 'attr vmware has correct value');
+
+# changing an attribute should work
+$inClient1->{attrs}->{vmware} = 'no';
+ok($configDB->changeClient(1, $inClient1), 'changing vmware in client 1');
+$client1 = $configDB->fetchClientByID(1);
+is($client1->{attrs}->{slxgrp}, 'slxgrp1', 'attr slxgrp has correct value');
+is($client1->{attrs}->{vmware}, 'no', 'attr vmware has correct value');
+
+# deleting an attribute should remove it
+delete $inClient1->{attrs}->{slxgrp};
+ok($configDB->changeClient(1, $inClient1), 'changing slxgrp in client 1');
+$client1 = $configDB->fetchClientByID(1);
+ok(!exists $client1->{attrs}->{slxgrp}, 'attr slxgrp should be gone');
+
+# undef'ing an attribute should remove it, too
+$inClient1->{attrs}->{vmware} = undef;
+ok($configDB->changeClient(1, $inClient1), 'undefining vmware in client 1');
+$client1 = $configDB->fetchClientByID(1);
+ok(!exists $client1->{attrs}->{vmware}, 'attr vmware should be gone');
+
# changing a non-existing column should fail
ok(
! eval { $configDB->changeClient(1, { xname => "xx" }) },
diff --git a/config-db/t/14-group.t b/config-db/t/14-group.t
index 59530257..b06620ce 100644
--- a/config-db/t/14-group.t
+++ b/config-db/t/14-group.t
@@ -339,6 +339,33 @@ is($group1->{name}, q{GRP-'1'}, q{really got group named "GRP-'1'"});
# changing nothing at all should succeed
ok($configDB->changeGroup(1), 'changing nothing at all in group 1');
+# adding attributes should work
+$inGroup1->{attrs}->{slxgrp} = 'slxgrp1';
+$inGroup1->{attrs}->{vmware} = 'yes';
+ok($configDB->changeGroup(1, $inGroup1), 'adding attrs to group 1');
+$group1 = $configDB->fetchGroupByID(1);
+is($group1->{attrs}->{slxgrp}, 'slxgrp1', 'attr slxgrp has correct value');
+is($group1->{attrs}->{vmware}, 'yes', 'attr vmware has correct value');
+
+# changing an attribute should work
+$inGroup1->{attrs}->{vmware} = 'no';
+ok($configDB->changeGroup(1, $inGroup1), 'changing vmware in group 1');
+$group1 = $configDB->fetchGroupByID(1);
+is($group1->{attrs}->{slxgrp}, 'slxgrp1', 'attr slxgrp has correct value');
+is($group1->{attrs}->{vmware}, 'no', 'attr vmware has correct value');
+
+# deleting an attribute should remove it
+delete $inGroup1->{attrs}->{slxgrp};
+ok($configDB->changeGroup(1, $inGroup1), 'changing slxgrp in group 1');
+$group1 = $configDB->fetchGroupByID(1);
+ok(!exists $group1->{attrs}->{slxgrp}, 'attr slxgrp should be gone');
+
+# undef'ing an attribute should remove it, too
+$inGroup1->{attrs}->{vmware} = undef;
+ok($configDB->changeGroup(1, $inGroup1), 'undefining vmware in group 1');
+$group1 = $configDB->fetchGroupByID(1);
+ok(!exists $group1->{attrs}->{vmware}, 'attr vmware should be gone');
+
# changing a non-existing column should fail
ok(
! eval { $configDB->changeGroup(1, { xname => "xx" }) },
diff --git a/config-db/t/25-attributes.t b/config-db/t/25-attributes.t
index ce83d037..0a83afa9 100644
--- a/config-db/t/25-attributes.t
+++ b/config-db/t/25-attributes.t
@@ -5,6 +5,8 @@ use warnings;
use lib '/opt/openslx/lib';
+use Storable qw(dclone);
+
# basic init
use OpenSLX::ConfigDB qw(:support);
@@ -12,25 +14,25 @@ my $configDB = OpenSLX::ConfigDB->new;
$configDB->connect();
my $defaultAttrs = { # mostly copied from DBSchema
- 'ramfs_fsmods' => '',
- 'ramfs_miscmods' => '',
+ 'ramfs_fsmods' => undef,
+ 'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32',
- 'ramfs_screen' => '',
+ 'ramfs_screen' => undef,
- 'automnt_dir' => '',
- 'automnt_src' => '',
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
'country' => 'de',
'dm_allow_shutdown' => 'user',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
'late_dm' => 'no',
'netbios_workgroup' => 'slx-network',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
- 'scratch' => '',
- 'slxgrp' => '',
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
+ 'scratch' => undef,
+ 'slxgrp' => undef,
'start_alsasound' => 'yes',
'start_atd' => 'no',
'start_cron' => 'no',
@@ -128,24 +130,24 @@ ok(
# default client attributes:
my $shouldBeAttrs1 = {
'ramfs_fsmods' => 'squashfs',
- 'ramfs_miscmods' => '',
+ 'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 r8169',
- 'ramfs_screen' => '',
+ 'ramfs_screen' => undef,
- 'automnt_dir' => '',
- 'automnt_src' => '',
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
'country' => 'de',
'dm_allow_shutdown' => 'user',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
'late_dm' => 'no',
'netbios_workgroup' => 'slx-network',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
- 'scratch' => '',
- 'slxgrp' => '',
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
+ 'scratch' => undef,
+ 'slxgrp' => undef,
'start_alsasound' => 'yes',
'start_atd' => 'no',
'start_cron' => 'no',
@@ -272,45 +274,45 @@ ok(
);
# check merging of attributes into client, the order should be:
-# default client attributes overruled by group attributes (ordererd by priority)
+# default client attributes overruled by group attributes (ordered by priority)
# overruled by specific client attributes:
$shouldBeAttrs1 = {
- 'ramfs_fsmods' => '',
- 'ramfs_miscmods' => '',
- 'ramfs_nicmods' => '',
- 'ramfs_screen' => '',
-
- 'automnt_dir' => '',
- 'automnt_src' => '',
- 'country' => '',
- 'dm_allow_shutdown' => '',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
- 'late_dm' => '',
- 'netbios_workgroup' => '',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
+ 'ramfs_fsmods' => undef,
+ 'ramfs_miscmods' => undef,
+ 'ramfs_nicmods' => undef,
+ 'ramfs_screen' => undef,
+
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
+ 'country' => undef,
+ 'dm_allow_shutdown' => undef,
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
+ 'late_dm' => undef,
+ 'netbios_workgroup' => undef,
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
'scratch' => '/dev/sdx3',
- 'slxgrp' => '',
- 'start_alsasound' => '',
- 'start_atd' => '',
- 'start_cron' => '',
- 'start_dreshal' => '',
- 'start_ntp' => '',
- 'start_nfsv4' => '',
- 'start_printer' => '',
- 'start_samba' => '',
+ 'slxgrp' => undef,
+ 'start_alsasound' => undef,
+ 'start_atd' => undef,
+ 'start_cron' => undef,
+ 'start_dreshal' => undef,
+ 'start_ntp' => undef,
+ 'start_nfsv4' => undef,
+ 'start_printer' => undef,
+ 'start_samba' => undef,
'start_snmp' => 'yes',
- 'start_sshd' => '',
- 'start_syslog' => '',
- 'start_x' => '',
- 'start_xdmcp' => '',
- 'tex_enable' => '',
+ 'start_sshd' => undef,
+ 'start_syslog' => undef,
+ 'start_x' => undef,
+ 'start_xdmcp' => undef,
+ 'tex_enable' => undef,
'timezone' => 'America/New_York',
- 'tvout' => '',
- 'vmware' => '',
+ 'tvout' => undef,
+ 'vmware' => undef,
};
my $mergedClient1 = $configDB->fetchClientByID(1);
ok(
@@ -319,48 +321,48 @@ ok(
);
foreach my $key (sort keys %$shouldBeAttrs1) {
is(
- $mergedClient1->{attrs}->{$key} || '', $shouldBeAttrs1->{$key} || '',
+ $mergedClient1->{attrs}->{$key}, $shouldBeAttrs1->{$key},
"checking merged attribute $key for client 1"
);
}
$shouldBeAttrs3 = {
- 'ramfs_fsmods' => '',
- 'ramfs_miscmods' => '',
- 'ramfs_nicmods' => '',
- 'ramfs_screen' => '',
-
- 'automnt_dir' => '',
- 'automnt_src' => '',
- 'country' => '',
- 'dm_allow_shutdown' => '',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
- 'late_dm' => '',
- 'netbios_workgroup' => '',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
- 'scratch' => '',
- 'slxgrp' => '',
- 'start_alsasound' => '',
- 'start_atd' => '',
- 'start_cron' => '',
- 'start_dreshal' => '',
- 'start_ntp' => '',
- 'start_nfsv4' => '',
- 'start_printer' => '',
- 'start_samba' => '',
+ 'ramfs_fsmods' => undef,
+ 'ramfs_miscmods' => undef,
+ 'ramfs_nicmods' => undef,
+ 'ramfs_screen' => undef,
+
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
+ 'country' => undef,
+ 'dm_allow_shutdown' => undef,
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
+ 'late_dm' => undef,
+ 'netbios_workgroup' => undef,
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
+ 'scratch' => undef,
+ 'slxgrp' => undef,
+ 'start_alsasound' => undef,
+ 'start_atd' => undef,
+ 'start_cron' => undef,
+ 'start_dreshal' => undef,
+ 'start_ntp' => undef,
+ 'start_nfsv4' => undef,
+ 'start_printer' => undef,
+ 'start_samba' => undef,
'start_snmp' => 'yes',
- 'start_sshd' => '',
- 'start_syslog' => '',
- 'start_x' => '',
- 'start_xdmcp' => '',
- 'tex_enable' => '',
+ 'start_sshd' => undef,
+ 'start_syslog' => undef,
+ 'start_x' => undef,
+ 'start_xdmcp' => undef,
+ 'tex_enable' => undef,
'timezone' => 'Europe/London',
- 'tvout' => '',
- 'vmware' => '',
+ 'tvout' => undef,
+ 'vmware' => undef,
};
# remove all attributes from client 3
@@ -373,7 +375,7 @@ ok(
);
foreach my $key (sort keys %$shouldBeAttrs1) {
is(
- $mergedClient3->{attrs}->{$key} || '', $shouldBeAttrs3->{$key} || '',
+ $mergedClient3->{attrs}->{$key}, $shouldBeAttrs3->{$key},
"checking merged attribute $key for client 3"
);
}
@@ -384,41 +386,41 @@ ok(
'group-IDs of default client have been set'
);
$shouldBeAttrs1 = {
- 'ramfs_fsmods' => '',
- 'ramfs_miscmods' => '',
- 'ramfs_nicmods' => '',
- 'ramfs_screen' => '',
-
- 'automnt_dir' => '',
- 'automnt_src' => '',
- 'country' => '',
- 'dm_allow_shutdown' => '',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
- 'late_dm' => '',
- 'netbios_workgroup' => '',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
+ 'ramfs_fsmods' => undef,
+ 'ramfs_miscmods' => undef,
+ 'ramfs_nicmods' => undef,
+ 'ramfs_screen' => undef,
+
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
+ 'country' => undef,
+ 'dm_allow_shutdown' => undef,
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
+ 'late_dm' => undef,
+ 'netbios_workgroup' => undef,
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
'scratch' => '/dev/sdx3',
- 'slxgrp' => '',
- 'start_alsasound' => '',
- 'start_atd' => '',
- 'start_cron' => '',
- 'start_dreshal' => '',
- 'start_ntp' => '',
- 'start_nfsv4' => '',
- 'start_printer' => '',
- 'start_samba' => '',
+ 'slxgrp' => undef,
+ 'start_alsasound' => undef,
+ 'start_atd' => undef,
+ 'start_cron' => undef,
+ 'start_dreshal' => undef,
+ 'start_ntp' => undef,
+ 'start_nfsv4' => undef,
+ 'start_printer' => undef,
+ 'start_samba' => undef,
'start_snmp' => 'yes',
- 'start_sshd' => '',
- 'start_syslog' => '',
- 'start_x' => '',
- 'start_xdmcp' => '',
- 'tex_enable' => '',
+ 'start_sshd' => undef,
+ 'start_syslog' => undef,
+ 'start_x' => undef,
+ 'start_xdmcp' => undef,
+ 'tex_enable' => undef,
'timezone' => 'America/New_York',
- 'tvout' => '',
+ 'tvout' => undef,
'vmware' => 'yes',
};
$mergedClient1 = $configDB->fetchClientByID(1);
@@ -428,47 +430,47 @@ ok(
);
foreach my $key (sort keys %$shouldBeAttrs1) {
is(
- $mergedClient1->{attrs}->{$key} || '', $shouldBeAttrs1->{$key} || '',
+ $mergedClient1->{attrs}->{$key}, $shouldBeAttrs1->{$key},
"checking merged attribute $key for client 1"
);
}
$shouldBeAttrs3 = {
- 'ramfs_fsmods' => '',
- 'ramfs_miscmods' => '',
- 'ramfs_nicmods' => '',
- 'ramfs_screen' => '',
-
- 'automnt_dir' => '',
- 'automnt_src' => '',
- 'country' => '',
- 'dm_allow_shutdown' => '',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
- 'late_dm' => '',
- 'netbios_workgroup' => '',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
+ 'ramfs_fsmods' => undef,
+ 'ramfs_miscmods' => undef,
+ 'ramfs_nicmods' => undef,
+ 'ramfs_screen' => undef,
+
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
+ 'country' => undef,
+ 'dm_allow_shutdown' => undef,
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
+ 'late_dm' => undef,
+ 'netbios_workgroup' => undef,
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
'scratch' => '/dev/hdd1',
- 'slxgrp' => '',
- 'start_alsasound' => '',
- 'start_atd' => '',
- 'start_cron' => '',
- 'start_dreshal' => '',
- 'start_ntp' => '',
- 'start_nfsv4' => '',
- 'start_printer' => '',
- 'start_samba' => '',
+ 'slxgrp' => undef,
+ 'start_alsasound' => undef,
+ 'start_atd' => undef,
+ 'start_cron' => undef,
+ 'start_dreshal' => undef,
+ 'start_ntp' => undef,
+ 'start_nfsv4' => undef,
+ 'start_printer' => undef,
+ 'start_samba' => undef,
'start_snmp' => 'yes',
- 'start_sshd' => '',
- 'start_syslog' => '',
- 'start_x' => '',
- 'start_xdmcp' => '',
- 'tex_enable' => '',
+ 'start_sshd' => undef,
+ 'start_syslog' => undef,
+ 'start_x' => undef,
+ 'start_xdmcp' => undef,
+ 'tex_enable' => undef,
'timezone' => 'Europe/London',
- 'tvout' => '',
+ 'tvout' => undef,
'vmware' => 'yes',
};
$mergedClient3 = $configDB->fetchClientByID(3);
@@ -478,37 +480,37 @@ ok(
);
foreach my $key (sort keys %$shouldBeAttrs1) {
is(
- $mergedClient3->{attrs}->{$key} || '', $shouldBeAttrs3->{$key} || '',
+ $mergedClient3->{attrs}->{$key}, $shouldBeAttrs3->{$key},
"checking merged attribute $key for client 3"
);
}
# finally we merge systems into clients and check the outcome of that
-my $fullMerge11 = { %$mergedClient1 };
+my $fullMerge11 = dclone($mergedClient1);
ok(
mergeAttributes($fullMerge11, $mergedSystem1),
'merging system 1 into client 1'
);
my $shouldBeAttrs11 = {
'ramfs_fsmods' => 'squashfs',
- 'ramfs_miscmods' => '',
+ 'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 r8169',
- 'ramfs_screen' => '',
+ 'ramfs_screen' => undef,
- 'automnt_dir' => '',
- 'automnt_src' => '',
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
'country' => 'de',
'dm_allow_shutdown' => 'user',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
'late_dm' => 'no',
'netbios_workgroup' => 'slx-network',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
'scratch' => '/dev/sdx3',
- 'slxgrp' => '',
+ 'slxgrp' => undef,
'start_alsasound' => 'yes',
'start_atd' => 'no',
'start_cron' => 'no',
@@ -529,36 +531,36 @@ my $shouldBeAttrs11 = {
};
foreach my $key (sort keys %$shouldBeAttrs11) {
is(
- $fullMerge11->{attrs}->{$key} || '', $shouldBeAttrs11->{$key} || '',
+ $fullMerge11->{attrs}->{$key}, $shouldBeAttrs11->{$key},
"checking merged attribute $key for client 1 / system 1"
);
}
-my $fullMerge31 = { %$mergedClient3 };
+my $fullMerge31 = dclone($mergedClient3);
ok(
mergeAttributes($fullMerge31, $mergedSystem1),
'merging system 1 into client 3'
);
my $shouldBeAttrs31 = {
'ramfs_fsmods' => 'squashfs',
- 'ramfs_miscmods' => '',
+ 'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 r8169',
- 'ramfs_screen' => '',
+ 'ramfs_screen' => undef,
- 'automnt_dir' => '',
- 'automnt_src' => '',
+ 'automnt_dir' => undef,
+ 'automnt_src' => undef,
'country' => 'de',
'dm_allow_shutdown' => 'user',
- 'hw_graphic' => '',
- 'hw_monitor' => '',
- 'hw_mouse' => '',
+ 'hw_graphic' => undef,
+ 'hw_monitor' => undef,
+ 'hw_mouse' => undef,
'late_dm' => 'no',
'netbios_workgroup' => 'slx-network',
- 'nis_domain' => '',
- 'nis_servers' => '',
- 'sane_scanner' => '',
+ 'nis_domain' => undef,
+ 'nis_servers' => undef,
+ 'sane_scanner' => undef,
'scratch' => '/dev/hdd1',
- 'slxgrp' => '',
+ 'slxgrp' => undef,
'start_alsasound' => 'yes',
'start_atd' => 'no',
'start_cron' => 'no',
@@ -579,12 +581,12 @@ my $shouldBeAttrs31 = {
};
foreach my $key (sort keys %$shouldBeAttrs31) {
is(
- $fullMerge31->{attrs}->{$key} || '', $shouldBeAttrs31->{$key} || '',
+ $fullMerge31->{attrs}->{$key}, $shouldBeAttrs31->{$key},
"checking merged attribute $key for client 3 / system 1"
);
}
-my $fullMerge13 = { %$mergedClient1 };
+my $fullMerge13 = dclone($mergedClient1);
ok(
mergeAttributes($fullMerge13, $mergedSystem3),
'merging system 3 into client 1'
@@ -629,12 +631,12 @@ my $shouldBeAttrs13 = {
};
foreach my $key (sort keys %$shouldBeAttrs13) {
is(
- $fullMerge13->{attrs}->{$key} || '', $shouldBeAttrs13->{$key} || '',
+ $fullMerge13->{attrs}->{$key}, $shouldBeAttrs13->{$key},
"checking merged attribute $key for client 1 / system 3"
);
}
-my $fullMerge33 = { %$mergedClient3 };
+my $fullMerge33 = dclone($mergedClient3);
ok(
mergeAttributes($fullMerge33, $mergedSystem3),
'merging system 3 into client 3'
@@ -679,7 +681,7 @@ my $shouldBeAttrs33 = {
};
foreach my $key (sort keys %$shouldBeAttrs33) {
is(
- $fullMerge33->{attrs}->{$key} || '', $shouldBeAttrs33->{$key} || '',
+ $fullMerge33->{attrs}->{$key}, $shouldBeAttrs33->{$key},
"checking merged attribute $key for client 3 / system 3"
);
}