Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leoarnold committed Apr 22, 2019
1 parent 02ca9d4 commit 33ac076
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ Installs, configures, and manages the CUPS service.
}
```

* `log_debug_level`: Sets the `LogDebugLevel` directive of the CUPS server.
* `log_debug_history`: Sets the `LogDebugHistory` directive of the CUPS server.

* `log_level`: Sets the `LogLevel` directive of the CUPS server.

Expand Down
2 changes: 1 addition & 1 deletion README.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ Installs, configures, and manages the CUPS service.
}
```

* `log_debug_level`: Sets the `LogDebugLevel` directive of the CUPS server.
* `log_debug_history`: Sets the `LogDebugHistory` directive of the CUPS server.

* `log_level`: Sets the `LogLevel` directive of the CUPS server.

Expand Down
4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Note that the `cupsd.conf` directive `Port 631` is equivalent to `Listen *:631`.
# *Warning*: For this module to work, it is *mandatory* that CUPS is listening on `localhost:631`.
# @param location Sets the access control lists for the CUPS web interface. Restricts access to localhost by default.
# @param log_debug_level Sets the `LogDebugLevel` directive of the CUPS server.
# @param log_debug_history Sets the `LogDebugHistory` directive of the CUPS server.
# @param log_level Sets the `LogLevel` directive of the CUPS server.
# @param log_time_format Sets the `LogTimeFormat` directive of the CUPS server.
# @param max_clients Specifies the maximum number of simultaneous clients to support.
Expand Down Expand Up @@ -70,7 +70,7 @@
Optional[String] $default_queue = undef,
Variant[String, Array[String]] $listen = ['localhost:631', '/var/run/cups/cups.sock'],
Optional[Variant[String, Hash]] $location = undef,
Optional[Integer] $log_debug_level = undef,
Optional[Integer] $log_debug_history = undef,
Optional[String] $log_level = undef,
Optional[String] $log_time_format = undef,
Optional[Integer] $max_clients = undef,
Expand Down
42 changes: 42 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,48 @@
end
end

describe 'log_debug_history' do
let(:facts) { any_supported_os }

context 'when not set' do
it { is_expected.to_not contain_file('/etc/cups/cupsd.conf').with(content: /^LogDebugHistory/) }
end

context 'when set to 5' do
let(:params) { { log_debug_history: 5 } }

it { is_expected.to contain_file('/etc/cups/cupsd.conf').with(content: /^LogDebugHistory 5$/) }
end
end

describe 'log_level' do
let(:facts) { any_supported_os }

context 'when not set' do
it { is_expected.to_not contain_file('/etc/cups/cupsd.conf').with(content: /^LogLevel/) }
end

context "when set to 'debug2'" do
let(:params) { { log_level: 'debug2' } }

it { is_expected.to contain_file('/etc/cups/cupsd.conf').with(content: /^LogLevel debug2$/) }
end
end

describe 'log_time_format' do
let(:facts) { any_supported_os }

context 'when not set' do
it { is_expected.to_not contain_file('/etc/cups/cupsd.conf').with(content: /^LogTimeFormat/) }
end

context "when set to 'usecs'" do
let(:params) { { log_time_format: 'usecs' } }

it { is_expected.to contain_file('/etc/cups/cupsd.conf').with(content: /^LogTimeFormat usecs$/) }
end
end

describe 'max_clients' do
let(:facts) { any_supported_os }

Expand Down
2 changes: 1 addition & 1 deletion templates/cupsd/_directives.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DefaultAuthType Basic
<%= "Listen #{l}" %>
<% end -%>
<% end -%>
<%= COMMENT_OUT if @log_debug_level.nil? -%>LogDebugLevel <%= @log_debug_level %>
<%= COMMENT_OUT if @log_debug_history.nil? -%>LogDebugHistory <%= @log_debug_history %>
<%= COMMENT_OUT if @log_level.nil? -%>LogLevel <%= @log_level %>
<%= COMMENT_OUT if @log_time_format.nil? -%>LogTimeFormat <%= @log_time_format %>
<%= COMMENT_OUT if @max_clients.nil? -%>MaxClients <%= @max_clients %>
Expand Down

0 comments on commit 33ac076

Please sign in to comment.