Skip to content

Commit

Permalink
Add tests and docs for debug_connections
Browse files Browse the repository at this point in the history
`Stdlib::IP::Address` also added to the type alias so that it accepts
IPv6 networks.
  • Loading branch information
alexjfisher committed Aug 30, 2020
1 parent 46c6a27 commit e9e8768
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
# already installed. If the fact is unavailable, it defaults to '1.6.0'.
# You may need to set this manually to get a working and idempotent
# configuration.
#
# @param debug_connections
# Configures nginx `debug_connection` lines in the `events` section of the nginx config.
# See http://nginx.org/en/docs/ngx_core_module.html#debug_connection
class nginx (
### START Nginx Configuration ###
Variant[Stdlib::Absolutepath, Boolean] $client_body_temp_path = $nginx::params::client_body_temp_path,
Expand Down
9 changes: 9 additions & 0 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,15 @@
attr: 'ssl_password_file',
value: '/path/to/password_file',
match: ' ssl_password_file /path/to/password_file;'
},
{
title: 'should contain debug_connection directives',
attr: 'debug_connections',
value: %w[127.0.0.1 unix:],
match: [
' debug_connection 127.0.0.1;',
' debug_connection unix:;'
]
}
].each do |param|
context "when #{param[:attr]} is #{param[:value]}" do
Expand Down
10 changes: 10 additions & 0 deletions spec/type_aliases/debugconnection_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'spec_helper'

describe 'Nginx::DebugConnection' do
it { is_expected.to allow_value('127.0.0.1') }
it { is_expected.to allow_value('localhost') }
it { is_expected.to allow_value('192.0.2.0/24') }
it { is_expected.to allow_value('::1') }
it { is_expected.to allow_value('2001:0db8::/32') }
it { is_expected.to allow_value('unix:') }
end
2 changes: 1 addition & 1 deletion types/debugconnection.pp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
type Nginx::DebugConnection = Variant[Stdlib::Host, Enum['unix:']]
type Nginx::DebugConnection = Variant[Stdlib::Host, Stdlib::IP::Address, Enum['unix:']]

0 comments on commit e9e8768

Please sign in to comment.