Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
mirror
chef-cron
Commits
816559d6
Commit
816559d6
authored
Apr 23, 2014
by
Sean OMeara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
savegame: broken specs
parent
3db253d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
16 deletions
+39
-16
resources/d.rb
resources/d.rb
+2
-1
spec/unit/cron_test/default_spec.rb
spec/unit/cron_test/default_spec.rb
+21
-1
test/fixtures/cookbooks/cron_test/recipes/default.rb
test/fixtures/cookbooks/cron_test/recipes/default.rb
+16
-14
No files found.
resources/d.rb
View file @
816559d6
...
...
@@ -42,7 +42,7 @@ def initialize(*args)
end
def
self
.
validate_predefined_value
(
spec
)
return
true
if
spec
==
''
return
true
if
spec
.
nil?
# Several special predefined values can substitute in the cron expression
if
[
'@reboot'
,
'@yearly'
,
'@annually'
,
'@monthly'
,
'@weekly'
,
'@daily'
,
'@midnight'
,
'@hourly'
].
include?
spec
.
downcase
return
true
...
...
@@ -52,6 +52,7 @@ def self.validate_predefined_value(spec)
end
def
self
.
validate_numeric
(
spec
,
min
,
max
)
# binding.pry
if
spec
.
is_a?
Fixnum
return
false
unless
spec
>=
min
&&
spec
<=
max
return
true
...
...
spec/unit/cron_test/default_spec.rb
View file @
816559d6
...
...
@@ -6,7 +6,7 @@ describe 'cron_test::default' do
end
it
'creates cron_d[bizarrely-scheduled-usage-report]'
do
expect
(
chef_run
).
to
create_cron
d
_d
(
'bizarrely-scheduled-usage-report'
).
with
(
expect
(
chef_run
).
to
create_cron_d
(
'bizarrely-scheduled-usage-report'
).
with
(
:minute
=>
'*/5'
,
:hour
=>
'1,23'
,
:day
=>
'2-5'
,
...
...
@@ -14,4 +14,24 @@ describe 'cron_test::default' do
:user
=>
'appuser'
)
end
it
'creates cron_d[test-month-usage-report]'
do
expect
(
chef_run
).
to
create_cron_d
(
'test-month-usage-report'
).
with
(
:minute
=>
'0'
,
:hour
=>
'6'
,
:day
=>
'1'
,
:command
=>
'/srv/app/scripts/generate_report'
,
:user
=>
'appuser'
)
end
it
'creates cron_d[test-month-usage-report]'
do
expect
(
chef_run
).
to
create_cron_d
(
'test-weekday-usage-report'
).
with
(
:minute
=>
'45'
,
:hour
=>
'13'
,
:day
=>
'7'
,
:command
=>
'/srv/app/scripts/generate_report'
,
:user
=>
'appuser'
)
end
end
test/fixtures/cookbooks/cron_test/recipes/default.rb
View file @
816559d6
#
# Cookbook Name:: cron
# Cookbook Name:: cron
_test
# Recipe:: test
#
# Copyright:: (c) 20
12, Opscod
e, Inc
.
# Copyright:: (c) 20
08-2014, Chef Softwar
e, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -28,18 +28,20 @@ cron_d 'bizarrely-scheduled-usage-report' do
action
:create
end
cron_d
"test-month-usage-report"
do
minute
"0"
hour
"6"
month
"1"
command
"/srv/app/scripts/generate_report"
user
"appuser"
cron_d
'test-month-usage-report'
do
minute
'0'
hour
'6'
month
'1'
command
'/srv/app/scripts/generate_report'
user
'appuser'
action
:create
end
cron_d
"test-weekday-usage-report"
do
minute
"45"
hour
"13"
weekday
"7"
command
"/srv/app/scripts/generate_report"
user
"appuser"
cron_d
'test-weekday-usage-report'
do
minute
'45'
hour
'13'
weekday
'7'
command
'/srv/app/scripts/generate_report'
user
'appuser'
action
:create
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment