Skip to content

Commit 5ec5260

Browse files
committed
Settle on 2 spaces per indentation level
1 parent f00255a commit 5ec5260

1 file changed

Lines changed: 48 additions & 48 deletions

File tree

test/bats/sidekiq-orchestrator.bats

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,81 +7,81 @@ load helpers/common
77

88
# Setup runs before each test
99
setup() {
10-
# Setup environment variables
11-
setup_test_env
12-
13-
# Ensure containers are running
14-
is_postgres_running && stop_postgres
15-
start_postgres
16-
is_redis_running && stop_redis
17-
start_redis
10+
# Setup environment variables
11+
setup_test_env
12+
13+
# Ensure containers are running
14+
is_postgres_running && stop_postgres
15+
start_postgres
16+
is_redis_running && stop_redis
17+
start_redis
1818
}
1919

2020
# Teardown runs after each test
2121
teardown() {
22-
(
23-
cd "$TEST_PIDDIR" || return 1
24-
shopt -s nullglob
25-
for pidfile in * ; do
26-
kill -15 "$(cat "$pidfile")"
27-
done
28-
)
29-
cleanup_containers 1
22+
(
23+
cd "$TEST_PIDDIR" || return 1
24+
shopt -s nullglob
25+
for pidfile in * ; do
26+
kill -15 "$(cat "$pidfile")"
27+
done
28+
)
29+
cleanup_containers 1
3030
}
3131

3232
@test "sanity" {
33-
cd "$(get_project_root)"
33+
cd "$(get_project_root)"
3434

35-
run_background 'o1' bundle exec sidekiq -c 1 -r ./examples/remote_executor.rb -q dynflow_orchestrator
36-
wait_for 5 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
35+
run_background 'o1' bundle exec sidekiq -c 1 -r ./examples/remote_executor.rb -q dynflow_orchestrator
36+
wait_for 5 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
3737

38-
run_background 'w1' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
39-
wait_for 5 1 grep -P 'class=Dynflow::Executors::Sidekiq::WorkerJobs::DrainMarker.*INFO: done' "$(bg_output_file w1)"
38+
run_background 'w1' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
39+
wait_for 5 1 grep -P 'class=Dynflow::Executors::Sidekiq::WorkerJobs::DrainMarker.*INFO: done' "$(bg_output_file w1)"
4040

41-
timeout 10 bundle exec ruby examples/remote_executor.rb client 1
42-
wait_for 1 1 grep -P 'dynflow: ExecutionPlan.*running >>.*stopped' "$(bg_output_file o1)"
41+
timeout 10 bundle exec ruby examples/remote_executor.rb client 1
42+
wait_for 1 1 grep -P 'dynflow: ExecutionPlan.*running >>.*stopped' "$(bg_output_file o1)"
4343
}
4444

4545
@test "only one orchestrator can be active at a time" {
46-
cd "$(get_project_root)"
46+
cd "$(get_project_root)"
4747

48-
run_background 'o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
49-
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
48+
run_background 'o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
49+
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
5050

51-
run_background 'o2' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
52-
wait_for 30 1 grep 'dynflow: Orchestrator lock already taken, entering passive mode.' "$(bg_output_file o2)"
51+
run_background 'o2' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
52+
wait_for 30 1 grep 'dynflow: Orchestrator lock already taken, entering passive mode.' "$(bg_output_file o2)"
5353
}
5454

5555
@test "multiple orchestrators can be active with multiple redis dbs" {
56-
cd "$(get_project_root)"
56+
cd "$(get_project_root)"
5757

58-
run_background 'o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
59-
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
58+
run_background 'o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
59+
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
6060

61-
run_background 'w1' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
61+
run_background 'w1' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
6262

63-
export REDIS_URL=${REDIS_URL%/0}/1
64-
run_background 'o2' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
65-
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o2)"
63+
export REDIS_URL=${REDIS_URL%/0}/1
64+
run_background 'o2' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
65+
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o2)"
6666

67-
run_background 'w2' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
67+
run_background 'w2' bundle exec sidekiq -r ./examples/remote_executor.rb -q default
6868

69-
# The client performs a round robin between the available executors
70-
# This should lead to each orchestrator handling one execution plan
71-
timeout 60 bundle exec ruby examples/remote_executor.rb client 2
72-
wait_for 1 1 grep -P 'dynflow: ExecutionPlan.*running >>.*stopped' "$(bg_output_file o1)"
73-
wait_for 1 1 grep -P 'dynflow: ExecutionPlan.*running >>.*stopped' "$(bg_output_file o2)"
69+
# The client performs a round robin between the available executors
70+
# This should lead to each orchestrator handling one execution plan
71+
timeout 60 bundle exec ruby examples/remote_executor.rb client 2
72+
wait_for 1 1 grep -P 'dynflow: ExecutionPlan.*running >>.*stopped' "$(bg_output_file o1)"
73+
wait_for 1 1 grep -P 'dynflow: ExecutionPlan.*running >>.*stopped' "$(bg_output_file o2)"
7474
}
7575

7676
@test "orchestrators do fail over" {
77-
cd "$(get_project_root)"
77+
cd "$(get_project_root)"
7878

79-
run_background 'o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
80-
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
79+
run_background 'o1' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
80+
wait_for 30 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o1)"
8181

82-
run_background 'o2' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
83-
wait_for 30 1 grep 'dynflow: Orchestrator lock already taken, entering passive mode.' "$(bg_output_file o2)"
82+
run_background 'o2' bundle exec sidekiq -r ./examples/remote_executor.rb -q dynflow_orchestrator -c 1
83+
wait_for 30 1 grep 'dynflow: Orchestrator lock already taken, entering passive mode.' "$(bg_output_file o2)"
8484

85-
kill -15 "$(cat "$TEST_PIDDIR/o1.pid")"
86-
wait_for 120 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o2)"
85+
kill -15 "$(cat "$TEST_PIDDIR/o1.pid")"
86+
wait_for 120 1 grep 'dynflow: Acquired orchestrator lock, entering active mode.' "$(bg_output_file o2)"
8787
}

0 commit comments

Comments
 (0)