[omd-commits] OMD Git: omd: Migrated nagvis tests to be compatible with 1.7x code

git version control git at mathias-kettner.de
Mon Sep 24 13:12:18 CEST 2012


Module:   omd
Branch:   master
Commit:   332d27f601fd6d4db6d33a39248c1093f36f8243
URL:      http://omdistro.org/projects/omd/repository/revisions/332d27f601fd6d4db6d33a39248c1093f36f8243

Author:   Lars Michelsen <lm at mathias-kettner.de>
Date:     Mon Sep 24 13:06:29 2012 +0200
Commiter: Lars Michelsen <lm at mathias-kettner.de>
Date:     Mon Sep 24 13:06:29 2012 +0200

Migrated nagvis tests to be compatible with 1.7x code

---

 packages/nagvis/Makefile                  |    2 +-
 packages/nagvis/nagvis-1.7-nightly.tar.gz |  Bin 0 -> 3488328 bytes
 packages/nagvis/update-nagvis             |    4 +-
 t/20-package_nagvis.t                     |   85 ++++-------------------------
 4 files changed, 14 insertions(+), 77 deletions(-)

diff --git a/packages/nagvis/Makefile b/packages/nagvis/Makefile
index 3f18bed..a5adb10 100644
--- a/packages/nagvis/Makefile
+++ b/packages/nagvis/Makefile
@@ -1,7 +1,7 @@
 include ../../Makefile.omd
 
 NAME = nagvis
-VERSION = 1.7.1
+VERSION = 1.7-nightly
 DIR = $(NAME)-$(VERSION)
 
 .PHONY: skel
diff --git a/packages/nagvis/nagvis-1.7-nightly.tar.gz b/packages/nagvis/nagvis-1.7-nightly.tar.gz
new file mode 100644
index 0000000..76845b8
Binary files /dev/null and b/packages/nagvis/nagvis-1.7-nightly.tar.gz differ
diff --git a/packages/nagvis/update-nagvis b/packages/nagvis/update-nagvis
index 1be07d8..31025c3 100755
--- a/packages/nagvis/update-nagvis
+++ b/packages/nagvis/update-nagvis
@@ -1,8 +1,8 @@
 #!/bin/bash
 if [ "$1" = "nightly" ]; then
-    VERSION=1.6-nightly
+    VERSION=1.7-nightly
     echo "Adding current nightly build..."
-    wget -O nagvis-$VERSION.tar.gz http://nagvis.org/share/nagvis-$VERSION.tar.gz
+    wget -O nagvis-$VERSION.tar.gz http://www.nagvis.org/share/nagvis-$VERSION.tar.gz
 else
     VERSION=$(wget -O - http://nagvis.org/stable_release.php 2>/dev/null)
     [ -z "$VERSION" ] && echo "ERROR: Got no version." && exit 1
diff --git a/t/20-package_nagvis.t b/t/20-package_nagvis.t
index 2ea4046..ea0e0e0 100644
--- a/t/20-package_nagvis.t
+++ b/t/20-package_nagvis.t
@@ -12,7 +12,7 @@ BEGIN {
     use lib "$FindBin::Bin/lib/lib/perl5";
 }
 
-my $num_tests = 449;
+my $num_tests = 382;
 if($ENV{NAGVIS_DEVEL}) {
     $num_tests += 3;
 }
@@ -41,7 +41,7 @@ my $version = site_nagvis_version($site);
 ##################################################
 # Check installation paths
 site_thing_exists($site, 'etc/nagvis/maps');
-site_thing_exists($site, 'etc/nagvis/automaps');
+site_thing_exists($site, 'etc/nagvis/geomap');
 site_thing_exists($site, 'etc/nagvis/conf.d');
 site_thing_exists($site, 'etc/nagvis/conf.d/omd.ini.php');
 site_thing_exists($site, 'etc/nagvis/conf.d/urls.ini.php');
@@ -140,6 +140,8 @@ my $urls = [
           like => '/, \'demo-germany\'/', 'skip_html_lint' => 1 }),
     url({ url  => "/nagvis/config.php?map=demo-germany",
           like => '/, \'demo-germany\'/', 'skip_html_lint' => 1 }),
+    url({ url  => "/nagvis/index.php?rotation=demo",
+          like => '/, \'demo-germany\'/', 'skip_html_lint' => 1 }),
   
     # Ajax fetched dialogs
     # FIXME: only valid when not using trusted auth:
@@ -290,8 +292,9 @@ TestUtils::test_url(
           like => [ '/form name="loginform"/', '/name="_username"/', '/name="_password"/' ]})
 );
 
+# perform a random request which sould not be allowed to be requested by non logged in users
 TestUtils::test_url(
-    url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg',
+    url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getHoverTemplate&name[]=default',
           like => [ '/{"message":"You are not authenticated"/' ]})
 );
 
@@ -317,13 +320,13 @@ TestUtils::test_url(
 );
 
 #diag('Test logging in at ajax API using _GET vars');
+# Use random page to login by GET vars
 TestUtils::test_url(
-    url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg'
+    url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getHoverTemplate&name[]=default'
                  .'&_username=omdadmin&_password=omd',
-          like => [ '/^{"mainCfg":/' ]})
+          like => [ '/"name":"default","css_file":/' ]})
 );
 
-
 # Disable dialog auth to use the environment auth for further testing
 $auth = $orig_auth;
 site_remove_file($site, 'etc/apache/conf.d/nagvis-auth.conf');
@@ -333,43 +336,6 @@ TestUtils::test_command({ cmd => $omd_bin." restart $site apache" });
 ##################################################
 # AJAX API tests
 
-# /nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg
-# {"mainCfg":1296327919} => mtime of <site>/etc/nagvis/nagvis.ini.php
-#
-# 1. Test the file age returned by NagVis and compare it with the mtime fetched by this test
-# 2. Touch the file and check if the API returns the new age
-# 3. Do the same with a map config file
-# 4. Do the same with an automap config file
-TestUtils::test_url(
-    api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg',
-              like => '/^{"mainCfg":'.site_nagvis_maincfg_mtime($site).'}$/' })
-);
-
-TestUtils::test_url(
-    api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg',
-              like => '/^{"mainCfg":'.site_touch($site, 'etc/nagvis/nagvis.ini.php').'}$/' })
-);
-
-TestUtils::test_url(
-    api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg&m[]=demo-germany',
-              like => '/^{"mainCfg":'.site_nagvis_maincfg_mtime($site).',"demo-germany":'.site_mtime($site, 'etc/nagvis/maps/demo-germany.cfg').'}$/' })
-);
-
-TestUtils::test_url(
-    api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg&m[]=demo-germany',
-              like => '/^{"mainCfg":'.site_nagvis_maincfg_mtime($site).',"demo-germany":'.site_touch($site, 'etc/nagvis/maps/demo-germany.cfg').'}$/' })
-);
-
-TestUtils::test_url(
-    api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg&am[]=__automap',
-              like => '/^{"mainCfg":'.site_nagvis_maincfg_mtime($site).',"__automap":'.site_mtime($site, 'etc/nagvis/automaps/__automap.cfg').'}$/' })
-);
-
-TestUtils::test_url(
-    api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=General&act=getCfgFileAges&f[]=mainCfg&am[]=__automap',
-              like => '/^{"mainCfg":'.site_nagvis_maincfg_mtime($site).',"__automap":'.site_touch($site, 'etc/nagvis/automaps/__automap.cfg').'}$/' })
-);
-
 # /nagvis/server/core/ajax_handler.php?mod=General&act=getHoverTemplate&name[]=default
 # [{"name":"default","code":"<...>"}]
 TestUtils::test_url(
@@ -414,7 +380,7 @@ TestUtils::test_url(
 # {"cellsperrow":4,"showautomaps":1,"showmaps":1,"showgeomap":0,"showmapthumbs":0,"showrotations":1,"page_title":"NagVis 1.5.7","favicon_image":"\/nagvis\/frontend\/nagvis-js\/images\/internal\/favicon.png","background_color":"#ffffff","lang_mapIndex":"Map Index","lang_automapIndex":"Automap Index","lang_rotationPools":"Rotation Pools","event_log":0,"event_log_level":"info","event_log_height":100,"event_log_hidden":1}
 TestUtils::test_url(
     api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=Overview&act=getOverviewProperties',
-              like => [ '/"showautomaps":1,"showmaps":1,"showgeomap":0,"showmapthumbs":0,"showrotations":1/', ]})
+              like => [ '/"showmaps":1,"showgeomap":0,"showmapthumbs":0,"showrotations":1/', ]})
 );
 
 # /nagvis/server/core/ajax_handler.php?mod=Overview&act=getOverviewMaps
@@ -423,12 +389,6 @@ TestUtils::test_url(
                    like => [ '/"alias":/', ]})
 );
 
-# /nagvis/server/core/ajax_handler.php?mod=Overview&act=getOverviewAutomaps
-TestUtils::test_url(
-    api_url_list({ url  => '/nagvis/server/core/ajax_handler.php?mod=Overview&act=getOverviewAutomaps',
-                   like => [ '/"alias":/', ]})
-);
-
 # /nagvis/server/core/ajax_handler.php?mod=Overview&act=getOverviewRotations
 TestUtils::test_url(
     api_url_list({ url  => '/nagvis/server/core/ajax_handler.php?mod=Overview&act=getOverviewRotations',
@@ -444,32 +404,9 @@ TestUtils::test_url(
 
 TestUtils::test_url(
   api_url_list({ url  => '/nagvis/server/core/ajax_handler.php?mod=Overview&act=getObjectStates&ty=state&i[]=automap-notexisting',
-                 like => [ '/"state":"ERROR/', '/Map configuration file does not exist/' ]})
-);
-
-###############################################################################
-# AUTOMAP
-###############################################################################
-# /nagvis/server/core/ajax_handler.php?mod=AutoMap&act=getAutomapProperties&show=__automap&childLayers=2
-TestUtils::test_url(
-    api_url({ url  => '/nagvis/server/core/ajax_handler.php?mod=AutoMap&act=getAutomapProperties&show=__automap&childLayers=2',
-              like => [ '/"map_name":"__automap","alias":"Default Automap"/', ]})
+                 like => [ '/"state":"ERROR/', '/Map Error: The path /' ]})
 );
 
-# /nagvis/server/core/ajax_handler.php?mod=AutoMap&act=getAutomapObjects&show=__automap&childLayers=2
-TestUtils::test_url(
-    api_url_list({ url  => '/nagvis/server/core/ajax_handler.php?mod=AutoMap&act=getAutomapObjects&show=__automap&childLayers=2',
-                   like => [ '/"type":"map"/', '/"name":"__automap"/' ]})
-);
-
-# /nagvis/server/core/ajax_handler.php?mod=AutoMap&act=getObjectStates&show=__automap&ty=state&i[]=0&t[]=host&n1[]=localhost&n2[]=&childLayers=2
-# FIXME: Test the different automap params
-TestUtils::test_url(
-    api_url_list({ url  => '/nagvis/server/core/ajax_handler.php?mod=AutoMap&act=getObjectStates&show=__automap&ty=state&i[]=0&t[]=host&n1[]=localhost&n2[]=&childLayers=2',
-                   like => [ '/"state":"/', ]})
-);
-  
-
 ###############################################################################
 # Test user config
 ###############################################################################



More information about the omd-commits mailing list