Skip to content

Commit 36edf68

Browse files
author
Gao Han
committed
Add test for parsing sudo
1 parent 2a24130 commit 36edf68

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/instance_agent/plugins/codedeploy/application_specification_test.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,30 @@ def make_app_spec
113113
end
114114
end
115115

116+
context "With sudo hook" do
117+
setup do
118+
#A single test script with all parameters
119+
@app_spec_string = <<-END
120+
version: 0.0
121+
os: linux
122+
hooks:
123+
test_hook:
124+
- location: test_location_1
125+
sudo: true
126+
runas: foo
127+
timeout: 30
128+
END
129+
end
130+
should "Return a collection containing test script 1" do
131+
app_spec = make_app_spec
132+
assert_not_equal nil, app_spec.hooks
133+
assert_equal ['test_location_1'] , app_spec.hooks["test_hook"].map(&:location)
134+
assert_equal [true], app_spec.hooks["test_hook"].map(&:sudo)
135+
assert_equal ['foo'] , app_spec.hooks["test_hook"].map(&:runas)
136+
assert_equal [30] , app_spec.hooks["test_hook"].map(&:timeout)
137+
end
138+
end
139+
116140
context "With two complete hooks" do
117141
setup do
118142
#A pair of test scripts with all parameters

0 commit comments

Comments
 (0)