Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'bodepd/master'

  • Loading branch information...
commit 31e74b59b36369cd128c169e0dad85e5e850974d 2 parents f61a98c + 0e1d4d3
@jes5199 authored
Showing with 231 additions and 4 deletions.
  1. +13 −0 spec/apply/classes/should_allow_param_class_default_override_spec.sh
  2. +13 −0 spec/apply/classes/should_allow_param_class_defaults_spec.sh
  3. +14 −0 spec/apply/classes/should_allow_param_class_post_inclusion_spec.sh
  4. +13 −0 spec/apply/classes/should_allow_param_classes_spec.sh
  5. +13 −0 spec/apply/classes/should_include_resources_from_class_spec.sh
  6. +14 −0 spec/apply/classes/should_not_auto_include_resources_from_class_spec.sh
  7. +13 −0 spec/apply/conditionals/should_evaluate_else_spec.sh
  8. +13 −0 spec/apply/conditionals/should_evaluate_elsif_spec.sh
  9. +13 −0 spec/apply/conditionals/should_evaluate_if_spec.sh
  10. +9 −0 spec/apply/hashes/should_not_reassign_spec.sh
  11. +13 −0 spec/apply/hashes/should_suport_title_arrays.sh
  12. +13 −0 spec/apply/hashes/should_support_array_values_spec.sh
  13. +13 −0 spec/apply/hashes/should_support_attr_assignment_spec.sh
  14. +13 −0 spec/apply/hashes/should_support_hash_for_conditionals_spec.sh
  15. +13 −0 spec/apply/hashes/should_support_indices_spec.sh
  16. +13 −0 spec/apply/hashes/should_support_titles.sh
  17. +6 −4 spec/resource/host/ticket_4131_should_not_create_without_ip_spec.sh
  18. +19 −0 spec/resource/package/should_install_spec.sh
View
13 spec/apply/classes/should_allow_param_class_default_override_spec.sh
@@ -0,0 +1,13 @@
+set -e
+#
+# we are testing that resources declared in a class
+# can be applied with an include statement
+. local_setup.sh
+OUTFILE=/tmp/class_param_use-$$
+$BIN/puppet apply <<PP | tee $OUTFILE
+class x(\$y, \$z='2') {
+ notice("\${y}-\${z}")
+}
+class {x: y => '1', z => '3'}
+PP
+grep "1-3" $OUTFILE
View
13 spec/apply/classes/should_allow_param_class_defaults_spec.sh
@@ -0,0 +1,13 @@
+set -e
+#
+# we are testing that resources declared in a class
+# can be applied with an include statement
+. local_setup.sh
+OUTFILE=/tmp/class_param_use-$$
+$BIN/puppet apply <<PP | tee $OUTFILE
+class x(\$y, \$z='2') {
+ notice("\${y}-\${z}")
+}
+class {x: y => '1'}
+PP
+grep "1-2" $OUTFILE
View
14 spec/apply/classes/should_allow_param_class_post_inclusion_spec.sh
@@ -0,0 +1,14 @@
+set -e
+#
+# we are testing that resources declared in a class
+# can be applied with an include statement
+. local_setup.sh
+OUTFILE=/tmp/class_param_use-$$
+$BIN/puppet apply <<PP | tee $OUTFILE
+class x(\$y, \$z) {
+ notice("\${y}-\${z}")
+}
+class {x: y => '1', z => '2'}
+include x
+PP
+grep "1-2" $OUTFILE
View
13 spec/apply/classes/should_allow_param_classes_spec.sh
@@ -0,0 +1,13 @@
+set -e
+#
+# we are testing that resources declared in a class
+# can be applied with an include statement
+. local_setup.sh
+OUTFILE=/tmp/class_param_use-$$
+$BIN/puppet apply <<PP | tee $OUTFILE
+class x(\$y, \$z) {
+ notice("\${y}-\${z}")
+}
+class {x: y => '1', z => '2'}
+PP
+grep "1-2" $OUTFILE
View
13 spec/apply/classes/should_include_resources_from_class_spec.sh
@@ -0,0 +1,13 @@
+set -e
+#
+# we are testing that resources declared in a class
+# can be applied with an include statement
+. local_setup.sh
+
+$BIN/puppet apply <<PP | tee /tmp/class_include-$$
+class x {
+ notify{'a':}
+}
+include x
+PP
+grep "defined 'message' as 'a'" /tmp/class_include-$$
View
14 spec/apply/classes/should_not_auto_include_resources_from_class_spec.sh
@@ -0,0 +1,14 @@
+set -e
+#
+# test that resource declared in classes are not applied without include
+#
+. local_setup.sh
+
+$BIN/puppet apply <<PP | tee /tmp/class_not_include-$$
+class x {
+ notify{'a':}
+}
+PP
+# postcondition - test that the file is empty
+# this assumes that we are running at notice level (not debug or verbose)
+[ ! -s /tmp/class_not_include-$$ ]
View
13 spec/apply/conditionals/should_evaluate_else_spec.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep else
+if( 1 == 2) {
+ notice('if')
+} elsif(2 == 3) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
13 spec/apply/conditionals/should_evaluate_elsif_spec.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep elsif
+if( 1 == 3) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
13 spec/apply/conditionals/should_evaluate_if_spec.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep if
+if( 1 == 1) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
9 spec/apply/hashes/should_not_reassign_spec.sh
@@ -0,0 +1,9 @@
+set -e
+
+. local_setup.sh
+
+# hash reassignment should fail
+$BIN/puppet apply <<PP | grep "Assigning to the hash 'my_hash' with an existing key 'one'"
+\$my_hash = {'one' => '1', 'two' => '2' }
+\$my_hash['one']='1.5'
+PP
View
13 spec/apply/hashes/should_suport_title_arrays.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep if
+if( 1 == 1) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
13 spec/apply/hashes/should_support_array_values_spec.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep if
+if( 1 == 1) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
13 spec/apply/hashes/should_support_attr_assignment_spec.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep if
+if( 1 == 1) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
13 spec/apply/hashes/should_support_hash_for_conditionals_spec.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep if
+if( 1 == 1) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
13 spec/apply/hashes/should_support_indices_spec.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep if
+if( 1 == 1) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
13 spec/apply/hashes/should_support_titles.sh
@@ -0,0 +1,13 @@
+set -e
+
+. local_setup.sh
+
+$BIN/puppet apply <<PP | grep notice | grep if
+if( 1 == 1) {
+ notice('if')
+} elsif(2 == 2) {
+ notice('elsif')
+} else {
+ notice('else')
+}
+PP
View
10 spec/resource/host/ticket_4131_should_not_create_without_ip_spec.sh
@@ -4,14 +4,16 @@ set -e
set -u
. local_setup.sh
+#
+# precondition - entry exists with namevar
+#
if ! grep test1 /etc/hosts; then
- echo "127.0.0.2 test1" > /etc/hosts
+ echo "127.0.0.2 test1" >> /etc/hosts
fi
if [ -f /tmp/hosts-$$ ]; then
rm /tmp/hosts-$$
fi
-echo 'yoyo'
-$BIN/puppet resource host test1 ensure=present target="/tmp/host-$$" host_aliases=alias1
-#| grep 'ip is a required attribute for hosts'
+# post-condition - ip address not specified, create should fail with message.
+$BIN/puppet resource host test1 ensure=present target="/tmp/host-$$" host_aliases=alias1 | grep 'ip is a required attribute for hosts'
View
19 spec/resource/package/should_install_spec.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -e
+set -u
+
+source local_setup.sh
+
+PACKAGE='yum-cron'
+
+# precondition
+if rpm -q $PACKAGE; then
+ rpm -ef $PACKAGE
+fi
+
+# run ralsh
+$BIN/puppet resource package yum-cron ensure=installed | grep 'ensure: created'
+
+# postcondition
+rpm -q $PACKAGE
Please sign in to comment.
Something went wrong with that request. Please try again.