Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test environment to Vagrant

Adds a modified version of the puppet script by deizel that sets up all
of the testing tools used in the build script. Additionally adds a
flag to params.pp that prevents the test environment from being
provisioned.
  • Loading branch information...
commit cd5f285f5fcc1dffb4548afa151fa4220e05e0ad 1 parent a67c94b
@shanethehat shanethehat authored
View
2  .gitmodules
@@ -6,4 +6,4 @@
url = https://github.com/example42/puppi
[submodule "puppet/modules/mysql"]
path = puppet/modules/mysql
- url = https://github.com/example42/puppet-mysql
+ url = https://github.com/example42/puppet-mysql
View
3  puppet/manifests/params.pp
@@ -14,5 +14,8 @@
# True if phpmyadmin needs to be installed, false if not.
$phpmyadmin = true
+ # True if the test suite needs to be installed, false for faster provisioning with no tests
+ $tests = true
+
#$debug = 'on'
}
View
3  puppet/modules/joindin/manifests/init.pp
@@ -4,4 +4,5 @@
include joindin::sql
include joindin::web
include joindin::app
-}
+ include joindin::test
+}
View
8 puppet/modules/joindin/manifests/test.pp
@@ -0,0 +1,8 @@
+class joindin::test {
+
+ # only include the test suite if required
+ if $params::tests == true {
+ include joindin::test::test
+ }
+
+}
View
99 puppet/modules/joindin/manifests/test/test.pp
@@ -0,0 +1,99 @@
+class joindin::test::test {
+
+ # Install ant to build test suite
+ package { 'ant':
+ #require => Notify['running'],
+ }
+
+ # Install required PEAR modules for test suite
+ package { 'php-pear':
+ #require => Notify['running'],
+ }
+
+ # Discover the phpunit pear channel first - must do this separately because
+ # there is no guarantee of which tool will install first
+ exec { 'phpunit-channel':
+ command => 'pear channel-discover pear.phpunit.de',
+ require => Package['php-pear'],
+ }
+
+ # Install test-suite tools
+ exec { 'php-unit':
+ creates => '/usr/bin/phpunit',
+ command => 'pear install phpunit/PHPUnit',
+ require => Exec['phpunit-channel'],
+ before => Notify['test'],
+ }
+
+ exec { 'phploc':
+ creates => '/usr/bin/phploc',
+ command => 'pear channel-discover components.ez.no && /
+ pear channel-discover pear.netpirates.net && /
+ pear channel-discover pear.symfony.com && /
+ pear install phpunit/phploc',
+ require => Exec['phpunit-channel'],
+ before => Notify['test'],
+ }
+
+ exec { 'phpcpd':
+ creates => '/usr/bin/phpcpd',
+ command => 'pear install phpunit/phpcpd',
+ require => Exec['phpunit-channel'],
+ before => Notify['test'],
+ }
+
+ package { 'php-xml':
+ require => Package['php-pear'],
+ }
+
+ exec { 'pdepend':
+ creates => '/usr/bin/pdepend',
+ command => 'pear channel-discover pear.pdepend.org && \
+ pear install pdepend/PHP_Depend-beta',
+ require => [
+ Package['php-xml'],
+ Package['php-pear']
+ ]
+ }
+
+ exec { 'phpmd':
+ creates => '/usr/bin/phpmd',
+ command => 'pear channel-discover pear.phpmd.org && \
+ pear install phpmd/PHP_PMD',
+ require => Exec['pdepend'],
+ before => Notify['test'],
+ }
+
+ exec { 'phing':
+ creates => '/usr/bin/phing',
+ command => 'pear channel-discover pear.phing.info && \
+ pear install phing/phing',
+ require => Package['php-pear'],
+ before => Notify['test'],
+ }
+
+ package { 'graphviz': }
+
+ exec { 'phpdoc':
+ creates => '/usr/bin/phpdoc',
+ command => 'pear channel-discover pear.phpdoc.org && \
+ pear install phpdoc/phpDocumentor-alpha',
+ require => [
+ Package['php-pear'],
+ Package['graphviz'],
+ ],
+ before => Notify['test'],
+ }
+
+ exec { 'phpcs':
+ creates => '/usr/bin/phpcs',
+ command => 'pear install PHP_CodeSniffer',
+ require => Package['php-pear'],
+ before => Notify['test'],
+ }
+
+ # Announce test-suite
+ notify { 'test':
+ message => 'Test-suite ready - run in VM with `cd /vagrant && phing',
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.