diff --git a/manifests/site.pp b/manifests/site.pp
index 8bff03e2e6..0c055b8c5f 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -1,3 +1,20 @@
+#
+# Top-level variables
+#
+# There must not be any whitespace between this comment and the variables or
+# in between any two variables in order for them to be correctly parsed and
+# passed around in test.sh
+#
+$elasticsearch_nodes = [
+  'elasticsearch01.openstack.org',
+  'elasticsearch02.openstack.org',
+  'elasticsearch03.openstack.org',
+  'elasticsearch04.openstack.org',
+  'elasticsearch05.openstack.org',
+  'elasticsearch06.openstack.org',
+  'elasticsearch07.openstack.org',
+]
+
 #
 # Default: should at least behave like an openstack server
 #
@@ -244,16 +261,6 @@ node 'wiki.openstack.org' {
   }
 }
 
-$elasticsearch_nodes = [
-  'elasticsearch01.openstack.org',
-  'elasticsearch02.openstack.org',
-  'elasticsearch03.openstack.org',
-  'elasticsearch04.openstack.org',
-  'elasticsearch05.openstack.org',
-  'elasticsearch06.openstack.org',
-  'elasticsearch07.openstack.org',
-]
-
 node 'logstash.openstack.org' {
   class { 'openstack_project::logstash':
     sysadmins                       => hiera('sysadmins', ['admin']),
diff --git a/test.sh b/test.sh
index 1bc035bd8a..dc8ebe3e4b 100755
--- a/test.sh
+++ b/test.sh
@@ -8,7 +8,14 @@ if [ ! -d applytest ] ; then
 fi
 
 csplit -sf applytest/puppetapplytest manifests/site.pp '/^$/' {*}
-sed -i -e 's/^[^[:space:]]/#&/g' applytest/puppetapplytest*
+sed -i -e 's/^[^][:space:]$]/#&/g' applytest/puppetapplytest*
 sed -i -e 's@hiera(.\([^.]*\).,\([^)]*\))@\2@' applytest/puppetapplytest*
+mv applytest/*00 applytest/head  # These are the top-level variables defined in site.pp
 
-find applytest -name 'puppetapplytest*' -print0 | xargs -0 -P $(nproc) -n 1 -I filearg sudo puppet apply --modulepath=${MODULE_PATH} --noop --verbose --debug filearg > /dev/null
+for f in `find applytest -name 'puppetapplytest*' -print` ; do
+    cat applytest/head $f > $f.final
+done
+
+find applytest -name 'puppetapplytest*.final' -print0 | \
+    xargs -0 -P $(nproc) -n 1 -I filearg \
+        sudo puppet apply --modulepath=${MODULE_PATH} --noop --verbose --debug filearg > /dev/null