-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
58 lines (49 loc) · 1.51 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
task default: :test
def run(cmd)
if pid = fork
pid, status = Process.wait2(pid)
if status.exitstatus != 0
exit status.exitstatus
end
else
exec(*cmd)
end
end
desc 'Build the Docker image used for tests'
task :build do
run(%w(docker build -t mongo-manager .))
end
namespace :build do
desc 'Build the Docker image used for tests with legacy servers'
task :legacy do
run(%w(docker build -f Dockerfile.legacy -t mongo-manager-legacy .))
end
end
TEST_COMMAND = %w(docker run --tmpfs /db:exec --init -it mongo-manager).freeze
LEGACY_TEST_COMMAND = %w(docker run --tmpfs /db:exec --init -it mongo-manager-legacy).freeze
desc 'Run all tests'
task test: %w(test:unit test:api test:cmd test:legacy)
namespace :test do
desc 'Run unit tests'
task unit: :build do
run(TEST_COMMAND + %w(bundle exec rspec -f Rfc::Aif spec/mongo_manager))
end
desc 'Run integration tests for the library'
task api: :build do
run(TEST_COMMAND + %w(bundle exec rspec -f Rfc::Aif
spec/integration/api/init_spec.rb
spec/integration/api/init_modern_spec.rb
))
end
desc 'Run integration tests for the command-line tool'
task cmd: :build do
run(TEST_COMMAND + %w(bundle exec rspec -f Rfc::Aif spec/integration/cmd))
end
desc 'Run integration tests for the library with legacy servers'
task legacy: 'build:legacy' do
run(LEGACY_TEST_COMMAND + %w(bundle exec rspec -f Rfc::Aif
spec/integration/api/init_spec.rb
spec/integration/api/init_legacy_spec.rb
))
end
end