Skip to content
Browse files

acu70678 - Fixed right_link specs after removing monit dep.

  • Loading branch information...
1 parent 34d0893 commit 06379bde6de4a00ed9f76ae88d13e74409f0b2c2 Brian committed
Showing with 24 additions and 29 deletions.
  1. +4 −5 INSTALL.rdoc
  2. +19 −21 spec/scripts/agent_checker_spec.rb
  3. +1 −3 spec/scripts/reenroller_spec.rb
View
9 INSTALL.rdoc
@@ -185,9 +185,8 @@ RightLink knows about the following values of RS_CLOUD:
== On-Boot Commands
-Under Linux these are accomplished with init scripts, optionally using monit
-for robustness. Under Windows, a system service spawns the agent process and
-monitors its health.
+Under Linux these are accomplished with init scripts. Under Windows, a system
+service spawns the agent process and monitors its health.
CAUTION: if your instance is attached to the RightScale dashboard, running
the commands below will cause it to begin running boot scripts! This is not
@@ -254,7 +253,7 @@ When the system is terminating, you should allow RightLink to run its decommissi
/var/cache | Cookbooks, attachments, temp files
/usr/bin | Public CLI: rs_tag, rs_debug, ...
/opt/rightscale/bin | Private CLI: rnac, rad, cook, ...
- /opt/rightscale/sandbox | Private sandbox (Ruby, RubyGems, monit, ...)
+ /opt/rightscale/sandbox | Private sandbox (Ruby, RubyGems, ...)
=== Windows Systems
@@ -269,4 +268,4 @@ Data files -- paths are relative to %COMMON_APPDATA%\RightScale
Program logic -- paths are relative to %ProgramFiles(x86)%
RightScale\RightLink | Application logic & support files
- RightScale\sandbox | Private sandbox (Ruby, RubyGems, monit, ...)
+ RightScale\sandbox | Private sandbox (Ruby, RubyGems, ...)
View
40 spec/scripts/agent_checker_spec.rb
@@ -18,6 +18,7 @@ module RightScale
def run_agent_checker(args)
replace_argv(args)
opts = subject.parse_args
+ subject.should_receive(:stop_agent_watcher)
subject.start(opts)
return 0
rescue SystemExit => e
@@ -41,27 +42,32 @@ def setup(hide_exception=false, retries=0)
flexmock(EM).should_receive(:error_handler)
flexmock(EM).should_receive(:run).with(Proc).and_return { |block| block.call }.once
pid_file = flexmock("PidFile")
+ pid_file_agent = flexmock("PidFile")
flexmock(PidFile).should_receive(:new).with("test-rchk", "/tmp").and_return(pid_file).once
- pid_file
+ flexmock(PidFile).should_receive(:new).with("test", "/tmp").and_return(pid_file_agent).once
+
+ [pid_file, pid_file_agent]
end
def start(options={}, additional_args=nil)
- pid_file = setup
- time_limit = if options[:monit]
- [options[:monit], options[:time_limit] || AgentChecker::DEFAULT_TIME_LIMIT].min
- else
- options[:time_limit] || AgentChecker::DEFAULT_TIME_LIMIT
- end
+ pid_file, pid_file_agent = setup
+ time_limit = options[:time_limit] || AgentChecker::DEFAULT_TIME_LIMIT
pid_file.should_receive(:check)
subject.should_receive(:daemonize)
pid_file.should_receive(:write)
pid_file.should_receive(:remove)
+
+ agent_running = options[:start_agent] ? false : true
+ pid_file_agent.should_receive(:check).and_return {
+ raise PidFile::AlreadyRunning if agent_running
+ false
+ }
+
flexmock(CommandRunner).should_receive(:start)
flexmock(EM).should_receive(:add_periodic_timer)\
.once\
.with(time_limit, Proc)\
.and_return { |time_limit, block| block.call}
- subject.should_receive(:check_monit) if options[:monit]
client = flexmock("CommandClient")
flexmock(CommandClient).should_receive(:new).with(123, 123).and_return(client)
client.should_receive(:send_command).with({:name => "check_connectivity"}, false, AgentChecker::COMMAND_IO_TIMEOUT, Proc)
@@ -72,7 +78,7 @@ def start(options={}, additional_args=nil)
end
def stop()
- pid_file = setup
+ pid_file, pid_file_agent = setup
if RightScale::Platform::windows?
pid_file.should_receive(:read_pid).and_return(:pid => 123, :listen_port => 123, :cookie => 123).once
client = flexmock("CommandClient")
@@ -80,6 +86,7 @@ def stop()
client.should_receive(:send_command).with({:name => :terminate}, verbose = false, timeout = 30, Proc).once
else
pid_file.should_receive(:read_pid).and_return(:pid => 123).once
+ pid_file_agent.should_receive(:check).and_return(false)
flexmock(Process).should_receive(:kill).with('TERM', 123).once
subject.should_receive(:terminate)
end
@@ -160,15 +167,6 @@ def ping(verbose=false)
it_should_behave_like 'command line argument'
end
- context 'monit option' do
- let(:short_name) {'--monit'}
- let(:long_name) {'--monit'}
- let(:key) {:monit}
- let(:value) {'100'}
- let(:expected_value){100}
- it_should_behave_like 'command line argument'
- end
-
context 'ping option' do
let(:short_name) {'-p'}
let(:long_name) {'--ping'}
@@ -217,9 +215,9 @@ def ping(verbose=false)
end
end
- context 'rchk --start --monit 300' do
- it 'it should run a daemon process and also monitor monit' do
- start({ :monit => 300 }, "--monit 300")
+ context 'rchk --start' do
+ it 'it should run a daemon process and also start the agent' do
+ start({ :start_agent => true })
end
end
View
4 spec/scripts/reenroller_spec.rb
@@ -29,9 +29,7 @@ def reenroll(resume=false)
flexmock(subject).should_receive(:system).with('net start RightScale')
else
flexmock(subject).should_receive(:process_running?).and_return(false)
- flexmock(subject).should_receive(:system).with('/opt/rightscale/sandbox/bin/monit -c /opt/rightscale/etc/monitrc stop checker').once
- flexmock(subject).should_receive(:system).with('/opt/rightscale/sandbox/bin/monit -c /opt/rightscale/etc/monitrc stop instance').once
- flexmock(subject).should_receive(:system).with('/opt/rightscale/sandbox/bin/monit -c /opt/rightscale/etc/monitrc quit').once
+ flexmock(subject).should_receive(:system).with('/opt/rightscale/bin/rchk --stop').once
flexmock(subject).should_receive(:cleanup_certificates).once
if resume
flexmock(subject).should_receive(:system).with("/etc/init.d/rightlink resume > /dev/null").once

0 comments on commit 06379bd

Please sign in to comment.
Something went wrong with that request. Please try again.