Skip to content

Commit deb5107

Browse files
authored
Remove obsolete shutdown cc uploader function and corresponding test. Draining for cc uploader is handled in cc uploader (#4457)
1 parent 5ea84df commit deb5107

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

lib/cloud_controller/drain.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,6 @@ def shutdown_delayed_worker(pid_path, timeout=15)
5858
send_signal('KILL', pid, process_name)
5959
end
6060

61-
def shutdown_cc_uploader(pid_path)
62-
pid = File.read(pid_path).to_i
63-
process_name = File.basename(pid_path, '.pid')
64-
# Initiate shutdown.
65-
send_signal('TERM', pid, process_name)
66-
67-
# Wait some additional time for cc_uploader to be terminated; otherwise write an error log message.
68-
log_shutdown_error(pid, process_name) unless wait_for_shutdown(pid, process_name, CC_UPLOADER_FINAL_TIMEOUT_SECONDS)
69-
70-
# force shutdown
71-
return if terminated?(pid, process_name)
72-
73-
log_info("Forcefully shutting down process '#{process_name}' with pid '#{pid}'")
74-
send_signal('KILL', pid, process_name)
75-
end
76-
7761
private
7862

7963
def send_signal(signal, pid, process_name)

spec/unit/lib/cloud_controller/drain_spec.rb

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -159,40 +159,5 @@ def log_contents
159159
end
160160
end
161161
end
162-
163-
describe '#shutdown_cc_uploader' do
164-
it 'sends TERM to the cc_uploader process specified in the pid file' do
165-
expect(Process).to receive(:kill).with('TERM', pid)
166-
167-
drain.shutdown_cc_uploader(pid_path)
168-
169-
log_contents do |log|
170-
expect(log).to include("Sending signal 'TERM' to process '#{pid_name}' with pid '#{pid}'")
171-
end
172-
end
173-
174-
it 'waits 900s after sending TERM' do
175-
allow(Process).to receive(:getpgid).with(pid).and_return(1)
176-
177-
drain.shutdown_cc_uploader(pid_path)
178-
179-
expect(drain).to have_received(:sleep).exactly(900).times
180-
log_contents do |log|
181-
expect(log).to include("Process '#{pid_name}' with pid '#{pid}' is still running - this indicates an error in the shutdown procedure!")
182-
end
183-
end
184-
185-
it 'sends KILL to the cc_uploader process if it is still running after 900s' do
186-
allow(Process).to receive(:getpgid).with(pid).and_return(1)
187-
allow(Process).to receive(:kill).with('TERM', pid)
188-
expect(Process).to receive(:kill).with('KILL', pid)
189-
190-
drain.shutdown_cc_uploader(pid_path)
191-
192-
log_contents do |log|
193-
expect(log).to include("Forcefully shutting down process '#{pid_name}' with pid '#{pid}'")
194-
end
195-
end
196-
end
197162
end
198163
end

0 commit comments

Comments
 (0)