summaryrefslogtreecommitdiffstats
path: root/config-db
diff options
context:
space:
mode:
authorOliver Tappe2008-09-04 22:04:45 +0200
committerOliver Tappe2008-09-04 22:04:45 +0200
commitefe70fb96a70c23c50ea34e26f245265397c3d85 (patch)
tree0bc9a5f13c55f8a065d5c9628cb8cb8788cf3616 /config-db
parent* removed default value for boot_type as that field no longer exists (it (diff)
downloadcore-efe70fb96a70c23c50ea34e26f245265397c3d85.tar.gz
core-efe70fb96a70c23c50ea34e26f245265397c3d85.tar.xz
core-efe70fb96a70c23c50ea34e26f245265397c3d85.zip
* wrestled client & system tests back into a working state
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2207 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db')
-rw-r--r--config-db/t/12-system.t63
-rw-r--r--config-db/t/13-client.t119
2 files changed, 26 insertions, 156 deletions
diff --git a/config-db/t/12-system.t b/config-db/t/12-system.t
index d10c6a76..0c3a3042 100644
--- a/config-db/t/12-system.t
+++ b/config-db/t/12-system.t
@@ -61,43 +61,24 @@ my $fullSystem = {
'export_id' => 3,
'comment' => 'nuff said',
'label' => 'BlingBling System - really kuul!',
- 'hidden' => '1',
'attrs' => {
'automnt_dir' => 'a',
'automnt_src' => 'b',
'country' => 'c',
- 'dm_allow_shutdown' => 'd',
- 'hw_graphic' => 'e',
- 'hw_monitor' => 'f',
- 'hw_mouse' => 'g',
+ 'hidden' => '1',
'kernel_params' => 'debug=3 console=ttyS1',
- 'late_dm' => 'h',
- 'netbios_workgroup' => 'i',
- 'nis_domain' => 'j',
- 'nis_servers' => 'k',
'ramfs_fsmods' => 'l',
'ramfs_miscmods' => 'm',
'ramfs_nicmods' => 'n',
- 'sane_scanner' => 'p',
'scratch' => 'q',
- 'slxgrp' => 'r',
- 'start_alsasound' => 's',
'start_atd' => 't',
'start_cron' => 'u',
'start_dreshal' => 'v',
'start_ntp' => 'w',
'start_nfsv4' => 'x',
- 'start_printer' => 'y',
- 'start_samba' => 'z',
'start_snmp' => 'A',
'start_sshd' => 'B',
- 'start_syslog' => 'C',
- 'start_x' => 'D',
- 'start_xdmcp' => 'E',
- 'tex_enable' => 'F',
'timezone' => 'G',
- 'tvout' => 'H',
- 'vmware' => 'I',
},
};
ok(
@@ -117,43 +98,24 @@ is($system3->{kernel}, 'vmlinuz-2.6.22.13-0.3-default', 'sys
is($system3->{export_id}, '3', 'system 3 - export_id');
is($system3->{comment}, 'nuff said', 'system 3 - comment');
is($system3->{label}, 'BlingBling System - really kuul!', 'system 3 - label');
-is($system3->{hidden}, '1', 'system 3 - hidden');
is($system3->{attrs}->{automnt_dir}, 'a', 'system 3 - attr automnt_dir');
is($system3->{attrs}->{automnt_src}, 'b', 'system 3 - attr automnt_src');
is($system3->{attrs}->{country}, 'c', 'system 3 - attr country');
-is($system3->{attrs}->{dm_allow_shutdown}, 'd', 'system 3 - attr dm_allow_shutdown');
-is($system3->{attrs}->{hw_graphic}, 'e', 'system 3 - attr hw_graphic');
-is($system3->{attrs}->{hw_monitor}, 'f', 'system 3 - attr hw_monitor');
-is($system3->{attrs}->{hw_mouse}, 'g', 'system 3 - attr hw_mouse');
+is($system3->{attrs}->{hidden}, '1', 'system 3 - attr hidden');
is($system3->{attrs}->{kernel_params}, 'debug=3 console=ttyS1', 'system 3 - attr kernel_params');
-is($system3->{attrs}->{late_dm}, 'h', 'system 3 - attr late_dm');
-is($system3->{attrs}->{netbios_workgroup}, 'i', 'system 3 - attr netbios_workgroup');
-is($system3->{attrs}->{nis_domain}, 'j', 'system 3 - attr nis_domain');
-is($system3->{attrs}->{nis_servers}, 'k', 'system 3 - attr nis_servers');
is($system3->{attrs}->{ramfs_fsmods}, 'l', 'system 3 - attr ramfs_fsmods');
is($system3->{attrs}->{ramfs_miscmods}, 'm', 'system 3 - attr ramfs_miscmods');
is($system3->{attrs}->{ramfs_nicmods}, 'n', 'system 3 - attr ramfs_nicmods');
-is($system3->{attrs}->{sane_scanner}, 'p', 'system 3 - attr sane_scanner');
is($system3->{attrs}->{scratch}, 'q', 'system 3 - attr scratch');
-is($system3->{attrs}->{slxgrp}, 'r', 'system 3 - attr slxgrp');
-is($system3->{attrs}->{start_alsasound}, 's', 'system 3 - attr start_alsasound');
is($system3->{attrs}->{start_atd}, 't', 'system 3 - attr start_atd');
is($system3->{attrs}->{start_cron}, 'u', 'system 3 - attr start_cron');
is($system3->{attrs}->{start_dreshal}, 'v', 'system 3 - attr start_dreshal');
is($system3->{attrs}->{start_ntp}, 'w', 'system 3 - attr start_ftp');
is($system3->{attrs}->{start_nfsv4}, 'x', 'system 3 - attr start_nfsv4');
-is($system3->{attrs}->{start_printer}, 'y', 'system 3 - attr start_printer');
-is($system3->{attrs}->{start_samba}, 'z', 'system 3 - attr start_samba');
is($system3->{attrs}->{start_snmp}, 'A', 'system 3 - attr start_snmp');
is($system3->{attrs}->{start_sshd}, 'B', 'system 3 - attr start_sshd');
-is($system3->{attrs}->{start_syslog}, 'C', 'system 3 - attr start_syslog');
-is($system3->{attrs}->{start_x}, 'D', 'system 3 - attr start_x');
-is($system3->{attrs}->{start_xdmcp}, 'E', 'system 3 - attr start_xdmcp');
-is($system3->{attrs}->{tex_enable}, 'F', 'system 3 - attr tex_enable');
is($system3->{attrs}->{timezone}, 'G', 'system 3 - attr timezone');
-is($system3->{attrs}->{tvout}, 'H', 'system 3 - attr tvout');
-is($system3->{attrs}->{vmware}, 'I', 'system 3 - attr vmware');
-is(keys %{$system3->{attrs}}, 34, 'system 3 - attribute count');
+is(keys %{$system3->{attrs}}, 17, 'system 3 - attribute count');
# fetch system 2 by a filter on id and check all values
ok(
@@ -178,9 +140,7 @@ is($system1->{export_id}, '1', 'system 1 - export_id');
is($system1->{kernel}, 'vmlinuz', 'system 1 - kernel');
is($system1->{comment}, '', 'system 1 - comment');
is($system1->{label}, 'sys-1', 'system 1 - label');
-is($system1->{hidden}, undef, 'system 1 - hidden');
is(keys %{$system1->{attrs}}, 3, 'system 1 - attribute count');
-is($system1->{attrs}->{kernel_params}, undef, 'system 1 - attr kernel_params');
is($system1->{attrs}->{ramfs_fsmods}, 'squashfs', 'system 1 - attr ramfs_fsmods');
is($system1->{attrs}->{ramfs_nicmods}, 'e1000 forcedeth r8169', 'system 1 - attr ramfs_nicmods');
is($system1->{attrs}->{start_sshd}, 'yes', 'system 1 - attr start_sshd');
@@ -220,17 +180,6 @@ is(@systems1And2, 2, 'should have got 2 systems');
is($systems1And2[0]->{id}, 1, 'first id should be 1');
is($systems1And2[1]->{id}, 2, 'second id should be 2');
-# fetch systems 1 & 2 by filter on hidden being undef'd
-ok(
- @systems1And2 = $configDB->fetchSystemByFilter({ hidden => undef }),
- 'fetch systems 1 & 2 by filter on hidden being undefined'
-);
-is(@systems1And2, 2, 'should have got 2 systems');
-# now sort by ID and check if we have really got 1 and 2
-@systems1And2 = sort { $a->{id} cmp $b->{id} } @systems1And2;
-is($systems1And2[0]->{id}, 1, 'first id should be 1');
-is($systems1And2[1]->{id}, 2, 'second id should be 2');
-
# try to fetch with multi-column filter
ok(
($system2, $system3)
@@ -276,7 +225,7 @@ is($system1Only[0]->{id}, 1, 'first id should be 1');
ok(
@system1Only = $configDB->fetchSystemByFilter( {
export_id => 1,
- hidden => undef,
+ comment => '',
}, 'id', {
ramfs_nicmods => 'e1000 forcedeth r8169',
slxgrp => undef,
@@ -319,9 +268,9 @@ is(
# fetch systems 1 & 2 by filter on attribute start_samba not existing
ok(
@systems1And2 = $configDB->fetchSystemByFilter( {}, undef, {
- start_samba => undef,
+ start_snmp => undef,
} ),
- 'fetch systems 1 & 2 by filter on attribute start_samba not existing'
+ 'fetch systems 1 & 2 by filter on attribute start_snmp not existing'
);
is(@systems1And2, 2, 'should have got 2 systems');
# now sort by ID and check if we have really got 1 and 2
diff --git a/config-db/t/13-client.t b/config-db/t/13-client.t
index c618d5db..8be71518 100644
--- a/config-db/t/13-client.t
+++ b/config-db/t/13-client.t
@@ -39,7 +39,6 @@ my $inClient1 = {
'mac' => '01:02:03:04:05:01',
'comment' => '',
'attrs' => {
- 'slxgrp' => 'slxgrp',
'start_snmp' => 'no',
'start_sshd' => 'yes',
},
@@ -51,50 +50,33 @@ is(
my $inClient2 = {
'name' => 'cli-2.0',
- 'unbootable' => 1,
'mac' => '01:02:03:04:05:02',
'comment' => undef,
- 'boot_type' => 'etherboot',
+ 'attrs' => {
+ 'boot_type' => 'etherboot',
+ 'unbootable' => 1,
+ }
};
my $fullClient = {
'name' => 'cli-nr-3',
'mac' => '01:02:03:04:05:03',
'comment' => 'nuff said',
- 'unbootable' => '0',
- 'boot_type' => 'pxe',
'attrs' => {
'automnt_dir' => 'a',
'automnt_src' => 'b',
+ 'boot_type' => 'pxe',
'country' => 'c',
- 'dm_allow_shutdown' => 'd',
- 'hw_graphic' => 'e',
- 'hw_monitor' => 'f',
- 'hw_mouse' => 'g',
'kernel_params_client' => 'debug=3 console=ttyS1',
- 'late_dm' => 'h',
- 'netbios_workgroup' => 'i',
- 'nis_domain' => 'j',
- 'nis_servers' => 'k',
- 'sane_scanner' => 'p',
'scratch' => 'q',
- 'slxgrp' => 'r',
- 'start_alsasound' => 's',
'start_atd' => 't',
'start_cron' => 'u',
'start_dreshal' => 'v',
'start_ntp' => 'w',
'start_nfsv4' => 'x',
- 'start_printer' => 'y',
- 'start_samba' => 'z',
'start_snmp' => 'A',
'start_sshd' => 'B',
- 'start_syslog' => 'C',
- 'start_x' => 'D',
- 'start_xdmcp' => 'E',
- 'tex_enable' => 'F',
'timezone' => 'G',
- 'tvout' => 'H',
- 'vmware' => 'I',
+ 'unbootable' => '0',
},
};
ok(
@@ -112,41 +94,22 @@ is($client3->{id}, '3', 'client 3 - id');
is($client3->{name}, 'cli-nr-3', 'client 3 - name');
is($client3->{mac}, '01:02:03:04:05:03', 'client 3 - mac');
is($client3->{comment}, 'nuff said', 'client 3 - comment');
-is($client3->{boot_type}, 'pxe', 'client 3 - boot_type');
-is($client3->{unbootable}, '0', 'client 3 - unbootable');
is($client3->{attrs}->{automnt_dir}, 'a', 'client 3 - attr automnt_dir');
is($client3->{attrs}->{automnt_src}, 'b', 'client 3 - attr automnt_src');
+is($client3->{attrs}->{boot_type}, 'pxe', 'client 3 - attr boot_type');
is($client3->{attrs}->{country}, 'c', 'client 3 - attr country');
-is($client3->{attrs}->{dm_allow_shutdown}, 'd', 'client 3 - attr dm_allow_shutdown');
-is($client3->{attrs}->{hw_graphic}, 'e', 'client 3 - attr hw_graphic');
-is($client3->{attrs}->{hw_monitor}, 'f', 'client 3 - attr hw_monitor');
-is($client3->{attrs}->{hw_mouse}, 'g', 'client 3 - attr hw_mouse');
is($client3->{attrs}->{kernel_params_client}, 'debug=3 console=ttyS1', 'client 3 - attr kernel_params_client');
-is($client3->{attrs}->{late_dm}, 'h', 'client 3 - attr late_dm');
-is($client3->{attrs}->{netbios_workgroup}, 'i', 'client 3 - attr netbios_workgroup');
-is($client3->{attrs}->{nis_domain}, 'j', 'client 3 - attr nis_domain');
-is($client3->{attrs}->{nis_servers}, 'k', 'client 3 - attr nis_servers');
-is($client3->{attrs}->{sane_scanner}, 'p', 'client 3 - attr sane_scanner');
is($client3->{attrs}->{scratch}, 'q', 'client 3 - attr scratch');
-is($client3->{attrs}->{slxgrp}, 'r', 'client 3 - attr slxgrp');
-is($client3->{attrs}->{start_alsasound}, 's', 'client 3 - attr start_alsasound');
is($client3->{attrs}->{start_atd}, 't', 'client 3 - attr start_atd');
is($client3->{attrs}->{start_cron}, 'u', 'client 3 - attr start_cron');
is($client3->{attrs}->{start_dreshal}, 'v', 'client 3 - attr start_dreshal');
is($client3->{attrs}->{start_ntp}, 'w', 'client 3 - attr start_ftp');
is($client3->{attrs}->{start_nfsv4}, 'x', 'client 3 - attr start_nfsv4');
-is($client3->{attrs}->{start_printer}, 'y', 'client 3 - attr start_printer');
-is($client3->{attrs}->{start_samba}, 'z', 'client 3 - attr start_samba');
is($client3->{attrs}->{start_snmp}, 'A', 'client 3 - attr start_snmp');
is($client3->{attrs}->{start_sshd}, 'B', 'client 3 - attr start_sshd');
-is($client3->{attrs}->{start_syslog}, 'C', 'client 3 - attr start_syslog');
-is($client3->{attrs}->{start_x}, 'D', 'client 3 - attr start_x');
-is($client3->{attrs}->{start_xdmcp}, 'E', 'client 3 - attr start_xdmcp');
-is($client3->{attrs}->{tex_enable}, 'F', 'client 3 - attr tex_enable');
is($client3->{attrs}->{timezone}, 'G', 'client 3 - attr timezone');
-is($client3->{attrs}->{tvout}, 'H', 'client 3 - attr tvout');
-is($client3->{attrs}->{vmware}, 'I', 'client 3 - attr vmware');
-is(keys %{$client3->{attrs}}, 31, 'client 3 - attribute count');
+is($client3->{attrs}->{unbootable}, '0', 'client 3 - attr unbootable');
+is(keys %{$client3->{attrs}}, 15, 'client 3 - attribute count');
# fetch client 2 by a filter on id and check all values
ok(
@@ -155,11 +118,11 @@ ok(
);
is($client2->{id}, 2, 'client 2 - id');
is($client2->{name}, 'cli-2.0', 'client 2 - name');
-is($client2->{unbootable}, '1', 'client 2 - unbootable');
is($client2->{mac}, '01:02:03:04:05:02', 'client 2 - mac');
is($client2->{comment}, undef, 'client 2 - comment');
-is($client2->{boot_type}, 'etherboot', 'client 2 - boot_type');
-is(keys %{$client2->{attrs}}, 0, 'client 2 - attribute count');
+is(keys %{$client2->{attrs}}, 2, 'client 2 - attribute count');
+is($client2->{attrs}->{boot_type}, 'etherboot', 'client 2 - attr boot_type');
+is($client2->{attrs}->{unbootable}, '1', 'client 2 - attr unbootable');
# fetch client 1 by filter on name and check all values
ok(
@@ -170,8 +133,7 @@ is($client1->{id}, 1, 'client 1 - id');
is($client1->{name}, 'cli-1', 'client 1 - name');
is($client1->{mac}, '01:02:03:04:05:01', 'client 1 - mac');
is($client1->{comment}, '', 'client 1 - comment');
-is(keys %{$client1->{attrs}}, 3, 'client 1 - attribute count');
-is($client1->{attrs}->{slxgrp}, 'slxgrp', 'client 1 - attr slxgrp');
+is(keys %{$client1->{attrs}}, 2, 'client 1 - attribute count');
is($client1->{attrs}->{start_snmp}, 'no', 'client 1 - attr start_snmp');
is($client1->{attrs}->{start_sshd}, 'yes', 'client 1 - attr start_sshd');
@@ -199,38 +161,10 @@ ok(
);
is(@clients, 4, 'should have got all four clients');
-# fetch clients 1 & 2 by filter on boot_type
-ok(
- my @clients1And3 = $configDB->fetchClientByFilter({ boot_type => 'pxe' }),
- 'fetch clients 1 & 3 by filter on boot_type'
-);
-is(@clients1And3, 2, 'should have got 2 clients');
-# now sort by ID and check if we have really got 1 and 3
-@clients1And3 = sort { $a->{id} cmp $b->{id} } @clients1And3;
-is($clients1And3[0]->{id}, 1, 'first id should be 1');
-is($clients1And3[1]->{id}, 3, 'second id should be 3');
-
-# try to fetch with multi-column filter
-ok(
- ($client1, $client3)
- = $configDB->fetchClientByFilter({ boot_type => 'pxe', id => 1 }),
- 'fetching client with boot_type=pxe and id=1 should work'
-);
-is($client1->{name}, 'cli-1', 'should have got cli-1');
-is($client3, undef, 'should not get cli-nr-3');
-
-# fetch client 1 by filter on unbootable being undef'd
-ok(
- my @client1Only = $configDB->fetchClientByFilter({ unbootable => undef }),
- 'fetch client 1 by filter on unbootable being undefined'
-);
-is(@client1Only, 1, 'should have got 1 client');
-is($client1Only[0]->{id}, 1, 'first id should be 1');
-
# try to fetch multiple occurrences of the same client, combined with
# some unknown IDs
ok(
- @clients1And3 = $configDB->fetchClientByID([ 1, 21, 4-1, 1, 4, 1, 1 ]),
+ my @clients1And3 = $configDB->fetchClientByID([ 1, 21, 4-1, 1, 4, 1, 1 ]),
'fetch a complex set of clients by ID'
);
is(@clients1And3, 2, 'should have got 2 clients');
@@ -241,7 +175,7 @@ is($clients1And3[1]->{id}, 3, 'second id should be 3');
# filter clients by different attributes & values in combination
ok(
- @client1Only = $configDB->fetchClientByFilter( {}, undef, {
+ my @client1Only = $configDB->fetchClientByFilter( {}, undef, {
start_snmp => 'no',
} ),
'fetch client 1 by filter on attribute start_snmp'
@@ -260,25 +194,12 @@ ok(
is(@client1Only, 1, 'should have got 1 client');
is($client1Only[0]->{id}, 1, 'first id should be 1');
-ok(
- @client1Only = $configDB->fetchClientByFilter( {
- name => 'cli-1',
- unbootable => undef,
- }, 'id', {
- start_snmp => 'no',
- tex_enable => undef,
- } ),
- 'fetch client 1 by multiple filter on values and attributes'
-);
-is(@client1Only, 1, 'should have got 1 client');
-is($client1Only[0]->{id}, 1, 'first id should be 1');
-
is(
$configDB->fetchClientByFilter( {
comment => 'xxx',
}, 'id', {
start_snmp => 'no',
- tex_enable => undef,
+ start_dreshal => undef,
} ),
undef,
'mismatch client 1 by filter with incorrect value'
@@ -288,7 +209,7 @@ is(
name => 'cli-1',
}, 'id', {
start_snmp => 'yes',
- tex_enable => undef,
+ start_dreshal => undef,
} ),
undef,
'mismatch client 1 by filter with incorrect attribute value'
@@ -303,12 +224,12 @@ is(
'mismatch client 1 by filter with attribute not being empty'
);
-# fetch clients 0, 1 & 2 by filter on attribute start_samba not existing
+# fetch clients 0, 1 & 2 by filter on attribute start_dreshal not existing
ok(
my @clients01And2 = $configDB->fetchClientByFilter( {}, undef, {
- start_samba => undef,
+ start_dreshal => undef,
} ),
- 'fetch clients 0,1 & 2 by filter on attribute start_samba not existing'
+ 'fetch clients 0,1 & 2 by filter on attribute start_dreshal not existing'
);
is(@clients01And2, 3, 'should have got 3 clients');
# now sort by ID and check if we have really got 0, 1 and 2