Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
mirror
yum
Commits
aebb032c
Commit
aebb032c
authored
Nov 24, 2014
by
Sean OMeara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing up tests
parent
d9c07989
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
15 deletions
+43
-15
providers/repository.rb
providers/repository.rb
+3
-3
spec/unit/test_repository_eight_spec.rb
spec/unit/test_repository_eight_spec.rb
+4
-0
spec/unit/test_repository_nine_spec.rb
spec/unit/test_repository_nine_spec.rb
+16
-12
spec/unit/test_repository_one_spec.rb
spec/unit/test_repository_one_spec.rb
+4
-0
spec/unit/test_repository_seven_spec.rb
spec/unit/test_repository_seven_spec.rb
+4
-0
spec/unit/test_repository_six_spec.rb
spec/unit/test_repository_six_spec.rb
+4
-0
spec/unit/test_repository_three_spec.rb
spec/unit/test_repository_three_spec.rb
+4
-0
spec/unit/test_repository_two_spec.rb
spec/unit/test_repository_two_spec.rb
+4
-0
No files found.
providers/repository.rb
View file @
aebb032c
...
...
@@ -37,10 +37,10 @@ action :create do
# of these when dropping Chef 10 support.
# support https transport
package
"
ca-certificates
"
do
package
'
ca-certificates
'
do
action
:upgrade
end
template
"/etc/yum.repos.d/
#{
new_resource
.
repositoryid
}
.repo"
do
if
new_resource
.
source
.
nil?
source
'repo.erb'
...
...
@@ -70,7 +70,7 @@ action :create do
end
end
action
:delete
do
action
:delete
do
file
"/etc/yum.repos.d/
#{
new_resource
.
repositoryid
}
.repo"
do
action
:delete
notifies
:run
,
"execute[yum clean
#{
new_resource
.
repositoryid
}
]"
,
:immediately
...
...
spec/unit/test_repository_eight_spec.rb
View file @
aebb032c
...
...
@@ -28,6 +28,10 @@ Have a nice day.
)
end
it
'steps into yum_repository and upgrades package[ca-certificates]'
do
expect
(
test_repository_eight_run
).
to
upgrade_package
(
'ca-certificates'
)
end
it
'steps into yum_repository and creates template[/etc/yum.repos.d/test8.repo]'
do
expect
(
test_repository_eight_run
).
to
create_template
(
'/etc/yum.repos.d/test8.repo'
)
.
with
(
...
...
spec/unit/test_repository_nine_spec.rb
View file @
aebb032c
require
'spec_helper'
describe
'yum_test::test_repository_nine'
do
let
(
:test_repository_
eight
_run
)
do
let
(
:test_repository_
nine
_run
)
do
ChefSpec
::
Runner
.
new
(
:step_into
=>
'yum_repository'
).
converge
(
described_recipe
)
end
let
(
:test_repository_
eight
_template
)
do
test_repository_
eight
_run
.
template
(
'/etc/yum.repos.d/test9.repo'
)
let
(
:test_repository_
nine
_template
)
do
test_repository_
nine
_run
.
template
(
'/etc/yum.repos.d/test9.repo'
)
end
let
(
:test_repository_
eight
_content
)
do
let
(
:test_repository_
nine
_content
)
do
'Hello there, I am a custom template.
baseurl: http://drop.the.baseurl.biz
Have a nice day.
...
...
@@ -20,7 +20,7 @@ Have a nice day.
context
'creating a yum_repository with minimal parameters'
do
it
'creates yum_repository[test9]'
do
expect
(
test_repository_
eight
_run
).
to
create_yum_repository
(
'test9'
)
expect
(
test_repository_
nine
_run
).
to
create_yum_repository
(
'test9'
)
.
with
(
:source
=>
'custom_template.erb'
,
:description
=>
'an test'
,
...
...
@@ -29,8 +29,12 @@ Have a nice day.
)
end
it
'steps into yum_repository and upgrades package[ca-certificates]'
do
expect
(
test_repository_nine_run
).
to
upgrade_package
(
'ca-certificates'
)
end
it
'steps into yum_repository and creates template[/etc/yum.repos.d/test9.repo]'
do
expect
(
test_repository_
eight
_run
).
to
create_template
(
'/etc/yum.repos.d/test9.repo'
)
expect
(
test_repository_
nine
_run
).
to
create_template
(
'/etc/yum.repos.d/test9.repo'
)
.
with
(
:path
=>
'/etc/yum.repos.d/test9.repo'
,
:source
=>
'custom_template.erb'
...
...
@@ -38,27 +42,27 @@ Have a nice day.
end
it
'steps into yum_repository and renders file[/etc/yum.repos.d/test9.repo]'
do
expect
(
test_repository_
eight
_run
).
to
render_file
(
'/etc/yum.repos.d/test9.repo'
)
.
with_content
(
test_repository_
eight
_content
)
expect
(
test_repository_
nine
_run
).
to
render_file
(
'/etc/yum.repos.d/test9.repo'
)
.
with_content
(
test_repository_
nine
_content
)
end
it
'steps into yum_repository and runs execute[yum-makecache-test9]'
do
expect
(
test_repository_
eight
_run
).
to_not
run_execute
(
'yum-makecache-test9'
)
expect
(
test_repository_
nine
_run
).
to_not
run_execute
(
'yum-makecache-test9'
)
.
with
(
:command
=>
'yum -q makecache --disablerepo=* --enablerepo=test9'
)
end
it
'steps into yum_repository and runs ruby_block[yum-cache-reload-test9]'
do
expect
(
test_repository_
eight
_run
).
to_not
run_ruby_block
(
'yum-cache-reload-test9'
)
expect
(
test_repository_
nine
_run
).
to_not
run_ruby_block
(
'yum-cache-reload-test9'
)
end
it
'sends a :run to execute[yum-makecache-test9]'
do
expect
(
test_repository_
eight
_template
).
to
notify
(
'execute[yum-makecache-test9]'
)
expect
(
test_repository_
nine
_template
).
to
notify
(
'execute[yum-makecache-test9]'
)
end
it
'sends a :create to ruby_block[yum-cache-reload-test9]'
do
expect
(
test_repository_
eight
_template
).
to
notify
(
'ruby_block[yum-cache-reload-test9]'
)
expect
(
test_repository_
nine
_template
).
to
notify
(
'ruby_block[yum-cache-reload-test9]'
)
end
end
...
...
spec/unit/test_repository_one_spec.rb
View file @
aebb032c
...
...
@@ -29,6 +29,10 @@ sslverify=true
expect
(
test_repository_one_run
).
to
create_yum_repository
(
'test1'
)
end
it
'steps into yum_repository and upgrades package[ca-certificates]'
do
expect
(
test_repository_one_run
).
to
upgrade_package
(
'ca-certificates'
)
end
it
'steps into yum_repository and creates template[/etc/yum.repos.d/test1.repo]'
do
expect
(
test_repository_one_run
).
to
create_template
(
'/etc/yum.repos.d/test1.repo'
)
end
...
...
spec/unit/test_repository_seven_spec.rb
View file @
aebb032c
...
...
@@ -30,6 +30,10 @@ sslverify=true
expect
(
test_repository_seven_run
).
to
create_yum_repository
(
'test7'
)
end
it
'steps into yum_repository and upgrades package[ca-certificates]'
do
expect
(
test_repository_seven_run
).
to
upgrade_package
(
'ca-certificates'
)
end
it
'steps into yum_repository and creates template[/etc/yum.repos.d/test7.repo]'
do
expect
(
test_repository_seven_run
).
to
create_template
(
'/etc/yum.repos.d/test7.repo'
)
end
...
...
spec/unit/test_repository_six_spec.rb
View file @
aebb032c
...
...
@@ -29,6 +29,10 @@ sslverify=true
expect
(
test_repository_six_run
).
to
create_yum_repository
(
'test6'
)
end
it
'steps into yum_repository and upgrades package[ca-certificates]'
do
expect
(
test_repository_six_run
).
to
upgrade_package
(
'ca-certificates'
)
end
it
'steps into yum_repository and creates template[/etc/yum.repos.d/test6.repo]'
do
expect
(
test_repository_six_run
).
to
create_template
(
'/etc/yum.repos.d/test6.repo'
)
end
...
...
spec/unit/test_repository_three_spec.rb
View file @
aebb032c
...
...
@@ -29,6 +29,10 @@ sslverify=true
expect
(
test_repository_three_run
).
to
add_yum_repository
(
'test3'
)
end
it
'steps into yum_repository and upgrades package[ca-certificates]'
do
expect
(
test_repository_three_run
).
to
upgrade_package
(
'ca-certificates'
)
end
it
'steps into yum_repository and creates template[/etc/yum.repos.d/test3.repo]'
do
expect
(
test_repository_three_run
).
to
create_template
(
'/etc/yum.repos.d/test3.repo'
)
end
...
...
spec/unit/test_repository_two_spec.rb
View file @
aebb032c
...
...
@@ -54,6 +54,10 @@ timeout=10
expect
(
test_repository_two_run
).
to
create_yum_repository
(
'test2'
)
end
it
'steps into yum_repository and upgrades package[ca-certificates]'
do
expect
(
test_repository_two_run
).
to
upgrade_package
(
'ca-certificates'
)
end
it
'steps into yum_repository and creates template[/etc/yum.repos.d/unit-test-2.repo]'
do
expect
(
test_repository_two_run
).
to
create_template
(
'/etc/yum.repos.d/unit-test-2.repo'
)
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