From: Robert 'phaylon' Sedlacek Date: Wed, 9 May 2012 19:37:00 +0000 (+0000) Subject: Puppet probe tests X-Git-Tag: v0.001_001~107 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b18174b879ea9ac526558e16ca13f31ffcae3b13;p=scpubgit%2FSystem-Introspector.git Puppet probe tests --- diff --git a/t/data/puppet/classes.txt b/t/data/puppet/classes.txt new file mode 100644 index 0000000..4d21925 --- /dev/null +++ b/t/data/puppet/classes.txt @@ -0,0 +1,4 @@ +user::foo +settings +user::foo +user::bar diff --git a/t/data/puppet/resources.txt b/t/data/puppet/resources.txt new file mode 100644 index 0000000..166527a --- /dev/null +++ b/t/data/puppet/resources.txt @@ -0,0 +1,7 @@ +user[foo] +exec[ls -lha] +file[/home/foo/quux] +package[baz] +group[bar] +invalid +foo[bar] diff --git a/t/puppet.t b/t/puppet.t new file mode 100644 index 0000000..0d8d206 --- /dev/null +++ b/t/puppet.t @@ -0,0 +1,26 @@ +use strictures 1; +use Test::More; +use FindBin; + +use System::Introspector::Puppet; + +my $probe = System::Introspector::Puppet->new( + classes_file => "$FindBin::Bin/data/puppet/classes.txt", + resources_file => "$FindBin::Bin/data/puppet/resources.txt", +); + +my $data = $probe->gather; +is_deeply $data->{classes}, + [qw( user::foo settings user::foo user::bar )], + 'classes parsing'; +is_deeply $data->{resources}, + [[user => 'foo'], + [exec => 'ls -lha'], + [file => '/home/foo/quux'], + [package => 'baz'], + [group => 'bar'], + [error => 'invalid'], + [foo => 'bar']], + 'resources parsing'; + +done_testing;