Skip to content

Commit cc2c261

Browse files
committed
Use random test ordering in actions workflow
1 parent 76730b4 commit cc2c261

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,26 @@ jobs:
2323
steps:
2424
- name: Checkout Repository
2525
uses: actions/checkout@v2
26-
- name: Configure Broker
26+
- name: Wait for Broker to Finish Starting
2727
run: |
28-
# Wait for rabbit
2928
set +e
30-
tries=5;
31-
while [[ $tries -gt 0 ]]; do
29+
tries=6;
30+
while true; do
3231
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'true = rabbit:is_running().'
3332
if [[ $? -ne 0 ]]; then
34-
((tries--)); sleep 10
33+
((tries--))
34+
if [[ $tries -gt 0 ]]; then
35+
echo "Rabbit is not yet running, will retry in 10s"
36+
sleep 10
37+
else
38+
exit 1
39+
fi
3540
else
36-
break
41+
exit 0
3742
fi
3843
done
39-
set -e
40-
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'true = rabbit:is_running().'
41-
44+
- name: Configure Broker for Test Suite
45+
run: |
4246
# Reduce retention policy for faster publishing of stats
4347
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().' || true
4448
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().' || true
@@ -48,4 +52,4 @@ jobs:
4852
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
4953
- name: Run Tests
5054
run: |
51-
bundle exec rspec -cfd spec
55+
bundle exec rspec --order rand -cfd spec

bin/ci/before_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ $CTL set_permissions -p / guest ".*" ".*" ".*"
2020

2121
# Reduce retention policy for faster publishing of stats
2222
$CTL eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().' || true
23-
$CTL eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().' || true
23+
$CTL eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().' || true

spec/integration/api_endpoints_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,15 +973,15 @@ def await_event_propagation
973973

974974
describe "GET /api/topic-permissions" do
975975
it "returns a list of topic permissions" do
976-
xs = subject.list_topic_permissions
977-
expect(xs.first.read).to_not be_nil
976+
p, *r = subject.list_topic_permissions
977+
expect(p.read).to_not be_nil
978978
end
979979

980980
end
981981

982982
describe "GET /api/topic-permissions/:vhost/:user" do
983983
it "returns a list of topic permissions of a user in a vhost" do
984-
p = subject.list_topic_permissions_of("/", "guest").first
984+
p, *r = subject.list_topic_permissions_of("/", "guest")
985985

986986
expect(p.exchange).to eq("amq.topic")
987987
expect(p.read).to eq(".*")

0 commit comments

Comments
 (0)