Skip to content

Commit

Permalink
Merge branch 'feature/interval-datatype' into release/v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Sep 1, 2023
2 parents 92c9ca9 + f2ef1c6 commit c1a73a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/type_aliases/interval_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'Icinga2::Interval' do
describe 'valid handling' do
[60, '3d', '3.5d', '4h', '4.1h', '5m', '5.2m', '60s', '60.4', '300', '300.25'].each do |value|
[60, '3d', '3.5d', '4h', '4.1h', '5m', '5.2m', '60s', '60.4', '300', '300.25', '$macro$', 'host.foo', 'service.foo'].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
Expand All @@ -13,7 +13,7 @@

describe 'invalid path handling' do
context 'garbage inputs' do
[nil, '', 'foo' ].each do |value|
[nil, '', 'm', 'foo', '2h4', 'host.', 'service.'].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
Expand Down
2 changes: 1 addition & 1 deletion types/interval.pp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# A strict type for intervals
type Icinga2::Interval = Variant[Integer, Pattern[/^\d+\.?\d*[d|h|m|s]?$/]]
type Icinga2::Interval = Variant[Integer, Pattern[/\A\d+\.?\d*[d|h|m|s]?\Z/, /\A\$.+\$\Z/, /\A(host|service)\..+/]]

0 comments on commit c1a73a9

Please sign in to comment.