Puppet probe tests
Robert 'phaylon' Sedlacek [Wed, 9 May 2012 19:37:00 +0000 (19:37 +0000)]
t/data/puppet/classes.txt [new file with mode: 0644]
t/data/puppet/resources.txt [new file with mode: 0644]
t/puppet.t [new file with mode: 0644]

diff --git a/t/data/puppet/classes.txt b/t/data/puppet/classes.txt
new file mode 100644 (file)
index 0000000..4d21925
--- /dev/null
@@ -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 (file)
index 0000000..166527a
--- /dev/null
@@ -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 (file)
index 0000000..0d8d206
--- /dev/null
@@ -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;