Skip to content

Commit

Permalink
Linting and adding some tests
Browse files Browse the repository at this point in the history
Adding tests
  • Loading branch information
tfhartmann authored and Morgan Haskel committed Nov 7, 2014
1 parent 92c6c9a commit b1b7689
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 25 deletions.
16 changes: 13 additions & 3 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@
'proxy_dest' => '/',
'proxy_pass' => [
{
'path' => '/a',
'url' => 'http://backend-a/'
'path' => '/a',
'url' => 'http://backend-a/',
'keywords' => ['noquery', 'interpolate'],
'params' => {
'retry' => '0',
'timeout' => '5'
}
}
],
'suphp_addhandler' => 'foo',
Expand Down Expand Up @@ -296,7 +301,12 @@
it { is_expected.to contain_concat__fragment('rspec.example.com-action') }
it { is_expected.to contain_concat__fragment('rspec.example.com-block') }
it { is_expected.to contain_concat__fragment('rspec.example.com-error_document') }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy') }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/retry=0/) }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/timeout=5/) }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/noquery interpolate/) }
it { is_expected.to contain_concat__fragment('rspec.example.com-rack') }
it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') }
it { is_expected.to contain_concat__fragment('rspec.example.com-rewrite') }
Expand Down
50 changes: 28 additions & 22 deletions tests/vhost_proxypass.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,58 @@

# Most basic vhost with proxy_pass
apache::vhost { 'first.example.com':
port => 80,
docroot => '/var/www/first',
proxy_pass => [
port => 80,
docroot => '/var/www/first',
proxy_pass => [
{
'path' => '/first',
'url' => "http://localhost:8080/first"
'path' => '/first',
'url' => 'http://localhost:8080/first'
},
],
}

# vhost with proxy_pass and parameters
apache::vhost { 'second.example.com':
port => 80,
docroot => '/var/www/second',
proxy_pass => [
port => 80,
docroot => '/var/www/second',
proxy_pass => [
{
'path' => '/second',
'url' => "http://localhost:8080/second",
'params' => {'retry' => '0', 'timeout' => '5'}
'url' => 'http://localhost:8080/second',
'params' => {
'retry' => '0',
'timeout' => '5'
}
},
],
}

# vhost with proxy_pass and keywords
apache::vhost { 'third.example.com':
port => 80,
docroot => '/var/www/third',
proxy_pass => [
port => 80,
docroot => '/var/www/third',
proxy_pass => [
{
'path' => '/third',
'url' => "http://localhost:8080/third",
'path' => '/third',
'url' => 'http://localhost:8080/third',
'keywords' => ['noquery', 'interpolate']
},
],
}

# vhost with proxy_pass, parameters and keywords
apache::vhost { 'fourth.example.com':
port => 80,
docroot => '/var/www/fourth',
proxy_pass => [
port => 80,
docroot => '/var/www/fourth',
proxy_pass => [
{
'path' => '/fourth',
'url' => "http://localhost:8080/fourth",
'params' => {'retry' => '0', 'timeout' => '5'},
'path' => '/fourth',
'url' => 'http://localhost:8080/fourth',
'params' => {
'retry' => '0',
'timeout' => '5'
},
'keywords' => ['noquery', 'interpolate']
},
],
}
}

0 comments on commit b1b7689

Please sign in to comment.