@@ -116,3 +116,63 @@ teardown() {
116116 timeout 30 bundle exec ruby examples/remote_executor.rb client 1
117117 wait_for 1 1 grep -P ' dynflow: ExecutionPlan.*running >>.*stopped' " $( bg_output_file o1) "
118118}
119+
120+ @test " active orchestrator can survive a brief redis connection drop" {
121+ cd " $( get_project_root) "
122+
123+ run_background ' o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
124+ wait_for 30 1 grep ' dynflow: Acquired orchestrator lock, entering active mode.' " $( bg_output_file o1) "
125+
126+ run_background ' w1' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
127+ wait_for 5 1 grep ' dynflow: Finished performing validity checks' " $( bg_output_file o1) "
128+
129+ stop_redis
130+ wait_for 30 1 grep ' Error connecting to Redis' " $( bg_output_file o1) "
131+ start_redis
132+
133+ timeout 10 bundle exec ruby examples/remote_executor.rb client 1
134+ wait_for 1 1 grep -P ' dynflow: ExecutionPlan.*running >>.*stopped' " $( bg_output_file o1) "
135+ }
136+
137+ @test " active orchestrator can survive a longer redis connection drop" {
138+ cd " $( get_project_root) "
139+
140+ run_background ' o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
141+ wait_for 30 1 grep ' dynflow: Acquired orchestrator lock, entering active mode.' " $( bg_output_file o1) "
142+
143+ run_background ' w1' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
144+ wait_for 5 1 grep ' dynflow: Finished performing validity checks' " $( bg_output_file o1) "
145+
146+ stop_redis 1
147+ wait_for 30 1 grep ' Error connecting to Redis' " $( bg_output_file o1) "
148+ start_redis
149+
150+ wait_for 30 1 grep ' The orchestrator lock was lost, reacquired' " $( bg_output_file o1) "
151+
152+ timeout 10 bundle exec ruby examples/remote_executor.rb client 1
153+ wait_for 1 1 grep -P ' dynflow: ExecutionPlan.*running >>.*stopped' " $( bg_output_file o1) "
154+ }
155+
156+ @test " orchestrators can fail over if active one goes away during downtime" {
157+ cd " $( get_project_root) "
158+
159+ run_background ' o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
160+ wait_for 30 1 grep ' dynflow: Acquired orchestrator lock, entering active mode.' " $( bg_output_file o1) "
161+
162+ run_background ' o2' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
163+ wait_for 30 1 grep ' dynflow: Orchestrator lock already taken, entering passive mode.' " $( bg_output_file o2) "
164+
165+ run_background ' w1' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
166+ wait_for 5 1 grep ' dynflow: Finished performing validity checks' " $( bg_output_file o1) "
167+
168+ stop_redis 1
169+ wait_for 30 1 grep ' Error connecting to Redis' " $( bg_output_file o1) "
170+ kill -15 " $( cat " $TEST_PIDDIR /o1.pid" ) "
171+ start_redis
172+
173+ wait_for 120 1 grep ' dynflow: Acquired orchestrator lock, entering active mode.' " $( bg_output_file o2) "
174+ wait_for 120 1 grep ' dynflow: Finished performing validity checks' " $( bg_output_file o2) "
175+
176+ timeout 10 bundle exec ruby examples/remote_executor.rb client 1
177+ wait_for 1 1 grep -P ' dynflow: ExecutionPlan.*running >>.*stopped' " $( bg_output_file o2) "
178+ }
0 commit comments