-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace validate_apache_loglevel() with data type #2023
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Apache::LogLevel' do | ||
[ | ||
'info', | ||
'warn ssl:info', | ||
'warn mod_ssl.c:info', | ||
'warn mod_ssl.c:info', | ||
'warn ssl_module:info', | ||
'trace4', | ||
].each do |allowed_value| | ||
it { is_expected.to allow_value(allowed_value) } | ||
end | ||
|
||
[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The regex is copied from the the function and is very lax and could be better. I thought about trying to make it stricter, but decided that a change like that might be suited to a separate PR. As things stand a
I think in a perfect world, $log_level would have actually accepted an |
||
'garbage', | ||
'', | ||
[], | ||
['info'], | ||
].each do |invalid_value| | ||
it { is_expected.not_to allow_value(invalid_value) } | ||
end | ||
end |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# @summary A string that conforms to the Apache `LogLevel` syntax. | ||
# | ||
# A string that conforms to the Apache `LogLevel` syntax. | ||
# Different levels can be specified for individual apache modules. | ||
# | ||
# ie. `[module:]level [module:level] ...` | ||
# | ||
# The levels are (in order of decreasing significance): | ||
# * `emerg` | ||
# * `alert` | ||
# * `crit` | ||
# * `error` | ||
# * `warn` | ||
# * `notice` | ||
# * `info` | ||
# * `debug` | ||
# * `trace1` | ||
# * `trace2` | ||
# * `trace3` | ||
# * `trace4` | ||
# * `trace5` | ||
# * `trace6` | ||
# * `trace7` | ||
# * `trace8` | ||
# | ||
# @see https://httpd.apache.org/docs/current/mod/core.html#loglevel | ||
type Apache::LogLevel = Pattern[/(emerg|alert|crit|error|warn|notice|info|debug|trace[1-8])/] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.