-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
73 lines (62 loc) · 1.76 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# frozen_string_literal: true
require "bundler"
require "bundler/gem_helper"
require "rake/testtask"
require "chefstyle"
require "rubocop/rake_task"
require "open3"
RuboCop::RakeTask.new
desc "Ruby syntax check"
task :syntax do
files = %w{Gemfile Rakefile} + Dir["./**/*.rb"]
files.each do |file|
sh("ruby", "-c", file) do |ok, res|
next if ok
puts "Syntax check FAILED"
exit res.exitstatus
end
end
end
namespace(:test) do
# desc 'Run all integration tests'
# task integration: %i(integration:sup_start integration:api_actual integration:cli_ssh_actual integration:sup_shutdown)
desc "Unit tests"
Rake::TestTask.new(:unit) do |t|
t.libs.concat %w{test/unit libraries}
t.test_files = FileList[
"test/unit/*_test.rb",
]
t.verbose = true
t.warning = false
end
desc "integration tests"
task integration: %i{integration:sup_start integration:integration_actual integration:sup_shutdown}
Rake::TestTask.new(:integration_actual) do |t|
t.libs.concat %w{test/integration}
t.test_files = FileList[
"test/integration/*_test.rb",
]
t.verbose = true
t.warning = false
end
namespace(:integration) do
{
# A hidden task to start a vagrant vm with a running supervisor
# It will expose SSH, httpd, and hab-sup
sup_start: "vagrant up",
# A hidden task to shutdown the vagrant vm with the supervisor
sup_shutdown: "vagrant destroy -f",
# Utility for debugging - Login to to the supervisor
sup_login: "vagrant ssh",
}.each do |task_name, cmd|
task task_name do
Dir.chdir("test/integration/sup-fixture") do
sh cmd
end
end
end
end
end
desc "Linting tasks"
task lint: %i{rubocop syntax}
task default: %i{lint test:unit}