summaryrefslogtreecommitdiffstats
path: root/src/config-db/t/15-global_info.t
diff options
context:
space:
mode:
authorSebastian Schmelzer2010-09-02 17:50:49 +0200
committerSebastian Schmelzer2010-09-02 17:50:49 +0200
commit416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 (patch)
tree4715f7d742fec50931017f38fe6ff0a89d4ceccc /src/config-db/t/15-global_info.t
parentFix for the problem reported on the list (sed filter forgotten for the (diff)
downloadcore-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.gz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.tar.xz
core-416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5.zip
change dir structure
Diffstat (limited to 'src/config-db/t/15-global_info.t')
-rw-r--r--src/config-db/t/15-global_info.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/config-db/t/15-global_info.t b/src/config-db/t/15-global_info.t
new file mode 100644
index 00000000..8f2f8cf1
--- /dev/null
+++ b/src/config-db/t/15-global_info.t
@@ -0,0 +1,43 @@
+use Test::More qw(no_plan);
+
+use strict;
+use warnings;
+
+use lib '/opt/openslx/lib';
+
+# basic init
+use OpenSLX::ConfigDB;
+
+my $configDB = OpenSLX::ConfigDB->new;
+$configDB->connect();
+
+# fetch global-info 'next-nbd-server-port'
+ok(
+ my $globalInfo = $configDB->fetchGlobalInfo('next-nbd-server-port'),
+ 'fetch global-info'
+);
+is($globalInfo, '5000', 'global-info - value');
+
+# try to fetch a couple of non-existing global-infos
+is(
+ $configDB->fetchGlobalInfo(-1), undef,
+ 'global-info with id -1 should not exist'
+);
+is($configDB->fetchGlobalInfo('xxx'), undef,
+ 'global-info with id xxx should not exist');
+
+# change value of global-info and then fetch and check the new value
+ok($configDB->changeGlobalInfo('next-nbd-server-port', '5050'), 'changing global-info');
+is(
+ $configDB->fetchGlobalInfo('next-nbd-server-port'), '5050',
+ 'fetching changed global-info'
+);
+
+# changing a non-existing global-info should fail
+ok(
+ ! eval { $configDB->changeGlobalInfo('xxx', 'new-value') },
+ 'changing unknown global-info should fail'
+);
+
+$configDB->disconnect();
+