Skip to content

Commit afbf855

Browse files
committed
Split sentinel, cluster and distributed test suites
This just move things around, but the goal is to run cluster an sentinel tests in distinct jobs on CI so it's easier to manage their inherent slowness and flakiness.
1 parent 585274e commit afbf855

File tree

85 files changed

+118
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+118
-125
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ Layout/RescueEnsureAlignment:
117117
Naming/HeredocDelimiterNaming:
118118
Enabled: false
119119

120+
Naming/VariableNumber:
121+
Enabled: false
122+
120123
Naming/FileName:
121124
Enabled: false
122125

Rakefile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@ Rake::TestTask.new :test do |t|
1616
end
1717

1818
namespace :test do
19-
task :set_socket_path do
20-
if ENV['SOCKET_PATH'].nil?
21-
sock_file = Dir.glob("#{__dir__}/**/redis.sock").first
22-
23-
if sock_file.nil?
24-
puts '`SOCKET_PATH` environment variable required'
25-
exit 1
26-
end
27-
28-
ENV['SOCKET_PATH'] = sock_file
19+
groups = %i(redis distributed sentinel cluster)
20+
groups.each do |group|
21+
Rake::TestTask.new(group) do |t|
22+
t.libs << "test"
23+
t.libs << "lib"
24+
t.test_files = FileList["test/#{group}/**/*_test.rb"]
2925
end
3026
end
27+
28+
lost_tests = Dir["test/**/*_test.rb"] - groups.map { |g| Dir["test/#{g}/**/*_test.rb"] }.flatten
29+
unless lost_tests.empty?
30+
abort "The following test files are in no group:\n#{lost_tests.join("\n")}"
31+
end
3132
end
3233

33-
Rake::Task[:test].enhance(["test:set_socket_path"])
34+
task test: ["test:redis", "test:distributed", "test:sentinel", "test:cluster"]
3435

3536
task default: :test

makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ BINARY := ${BUILD_DIR}/src/redis-server
88
REDIS_CLIENT := ${BUILD_DIR}/src/redis-cli
99
REDIS_TRIB := ${BUILD_DIR}/src/redis-trib.rb
1010
PID_PATH := ${BUILD_DIR}/redis.pid
11-
SOCKET_PATH := ${BUILD_DIR}/redis.sock
11+
SOCKET_PATH := ${TMP}/redis.sock
1212
PORT := 6381
1313
SLAVE_PORT := 6382
1414
SLAVE_PID_PATH := ${BUILD_DIR}/redis_slave.pid
@@ -38,7 +38,7 @@ ${BINARY}: ${TMP}
3838
@bin/build ${REDIS_BRANCH} $<
3939

4040
test:
41-
@env SOCKET_PATH=${SOCKET_PATH} bundle exec rake test
41+
@env REDIS_SOCKET_PATH=${SOCKET_PATH} bundle exec rake test
4242

4343
stop:
4444
@$(call kill-redis,${PID_PATH});\

test/cluster_abnormal_state_test.rb renamed to test/cluster/abnormal_state_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative 'helper'
3+
require "helper"
44

55
# ruby -w -Itest test/cluster_abnormal_state_test.rb
66
class TestClusterAbnormalState < Minitest::Test

test/cluster_blocking_commands_test.rb renamed to test/cluster/blocking_commands_test.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative 'helper'
4-
require_relative 'lint/blocking_commands'
3+
require "helper"
54

65
# ruby -w -Itest test/cluster_blocking_commands_test.rb
76
class TestClusterBlockingCommands < Minitest::Test

test/cluster_client_internals_test.rb renamed to test/cluster/client_internals_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative 'helper'
3+
require "helper"
44

55
# ruby -w -Itest test/cluster_client_internals_test.rb
66
class TestClusterClientInternals < Minitest::Test

test/cluster_client_key_hash_tags_test.rb renamed to test/cluster/client_key_hash_tags_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative 'helper'
3+
require "helper"
44

55
# ruby -w -Itest test/cluster_client_key_hash_tags_test.rb
66
class TestClusterClientKeyHashTags < Minitest::Test

test/cluster_client_pipelining_test.rb renamed to test/cluster/client_pipelining_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative 'helper'
3+
require "helper"
44

55
# ruby -w -Itest test/cluster_client_pipelining_test.rb
66
class TestClusterClientPipelining < Minitest::Test

test/cluster_client_replicas_test.rb renamed to test/cluster/client_replicas_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require_relative 'helper'
3+
require "helper"
44

55
# ruby -w -Itest test/cluster_client_replicas_test.rb
66
class TestClusterClientReplicas < Minitest::Test

0 commit comments

Comments
 (0)