Hashar has uploaded a new change for review.
https://gerrit.wikimedia.org/r/71789
Change subject: pupptest-test-runner a wrapper to run puppet tests
......................................................................
pupptest-test-runner a wrapper to run puppet tests
The shell script will lookup for any .pp manifests having 'tests'
somewhere along their path. It will then invoke in parralel a run to
puppet apply --noop.
Change-Id: I284553844cf1c690c58b015726594788973fc601
---
A bin/puppet-test-runner.sh
1 file changed, 49 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/integration/jenkins
refs/changes/89/71789/1
diff --git a/bin/puppet-test-runner.sh b/bin/puppet-test-runner.sh
new file mode 100755
index 0000000..9371391
--- /dev/null
+++ b/bin/puppet-test-runner.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# puppet-test-runner - run puppet apply --noop to manifests in 'tests' dirs
+#
+# Written by Antoine Musso, July 2013
+#
+#
+# Copyright © 2013, Antoine Musso
+# Copyright © 2013, Wikimedia Foundation Inc.
+
+# Directory where the puppet modules are located
+MODULE_DIR=`pwd`"/modules"
+
+# Maximum number of 'puppet apply --noop' operations to triggers (xargs -P)
+MAX_JOBS=4
+
+# puppet_apply_noop ()
+# Wrapper around puppet apply noop
+# Requires an export of MODULE_DIR that points to the puppet modules directory.
+#
+# Parameter: path to a puppet manifest
+# Returns: exit code of puppet apply
+#
+puppet_apply_noop() {
+ manifest="$1"
+
+ echo "info: Invoking puppet on '$1'"
+
+ puppet apply --noop --modulepath="$MODULE_DIR" $manifest
+
+ test_result=$?
+ [[ $test_result != 0 ]] && echo "error: failed tests for '$manifest'"
+ return $test_result
+}
+
+echo "info: Will assume modules are under '$MODULE_DIR'"
+TEST_FILES=`find . -type f -wholename '*tests/*.pp'`
+
+echo "info: Triggering tests using up to $MAX_JOBS puppet runners"
+
+# Export environnent so that is made available to the subshell executed
+# by xargs.
+export MODULE_DIR
+export -f puppet_apply_noop
+
+echo $TEST_FILES|xargs -t -I '{}' -P$MAX_JOBS -n1 bash -c 'puppet_apply_noop
{}'
+FINAL_EXIT_CODE=$?
+
+echo "info: Final exit code: $FINAL_EXIT_CODE"
--
To view, visit https://gerrit.wikimedia.org/r/71789
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I284553844cf1c690c58b015726594788973fc601
Gerrit-PatchSet: 1
Gerrit-Project: integration/jenkins
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits