|
37 | 37 | end
|
38 | 38 |
|
39 | 39 | describe ".instances" do
|
40 |
| - it "should has a .instances method" do |
| 40 | + it "should have a .instances method" do |
41 | 41 | expect(provider_class).to respond_to :instances
|
42 | 42 | end
|
43 | 43 |
|
|
63 | 63 | describe "when starting a service" do
|
64 | 64 | it "should execute the startsrc command" do
|
65 | 65 | @provider.expects(:execute).with(['/usr/bin/startsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true})
|
| 66 | + @provider.expects(:status).returns :running |
66 | 67 | @provider.start
|
67 | 68 | end
|
| 69 | + |
| 70 | + it "should error if timeout occurs while stopping the service" do |
| 71 | + @provider.expects(:execute).with(['/usr/bin/startsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true}) |
| 72 | + Timeout.expects(:timeout).with(60).raises(Timeout::Error) |
| 73 | + expect { @provider.start }.to raise_error Puppet::Error, ('Timed out waiting for myservice to transition states') |
| 74 | + end |
68 | 75 | end
|
69 | 76 |
|
70 | 77 | describe "when stopping a service" do
|
71 | 78 | it "should execute the stopsrc command" do
|
72 | 79 | @provider.expects(:execute).with(['/usr/bin/stopsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true})
|
| 80 | + @provider.expects(:status).returns :stopped |
73 | 81 | @provider.stop
|
74 | 82 | end
|
| 83 | + |
| 84 | + it "should error if timeout occurs while stopping the service" do |
| 85 | + @provider.expects(:execute).with(['/usr/bin/stopsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true}) |
| 86 | + Timeout.expects(:timeout).with(60).raises(Timeout::Error) |
| 87 | + expect { @provider.stop }.to raise_error Puppet::Error, ('Timed out waiting for myservice to transition states') |
| 88 | + end |
75 | 89 | end
|
76 | 90 |
|
77 | 91 | describe "should have a set of methods" do
|
|
160 | 174 | @provider.restart
|
161 | 175 | end
|
162 | 176 |
|
163 |
| - it "should execute restart which runs stopsrc then startsrc" do |
| 177 | + it "should execute restart which runs stop then start" do |
164 | 178 | sample_output = <<_EOF_
|
165 | 179 | #subsysname:synonym:cmdargs:path:uid:auditid:standin:standout:standerr:action:multi:contact:svrkey:svrmtype:priority:signorm:sigforce:display:waittime:grpname:
|
166 | 180 | myservice::--no-daemonize:/usr/sbin/puppetd:0:0:/dev/null:/var/log/puppet.log:/var/log/puppet.log:-O:-Q:-S:0:0:20:15:9:-d:20::"
|
167 | 181 | _EOF_
|
| 182 | + |
168 | 183 | @provider.expects(:execute).with(['/usr/bin/lssrc', '-Ss', "myservice"]).returns sample_output
|
169 |
| - @provider.expects(:execute).with(['/usr/bin/stopsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true}) |
170 |
| - @provider.expects(:execute).with(['/usr/bin/startsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true}) |
| 184 | + @provider.expects(:stop) |
| 185 | + @provider.expects(:start) |
171 | 186 | @provider.restart
|
172 | 187 | end
|
173 | 188 | end
|
|
0 commit comments