|
22 | 22 | require 'rake'
|
23 | 23 |
|
24 | 24 | #----------------------------------------------------------- integration tests
|
25 |
| -begin |
26 |
| - require 'kitchen/rake_tasks' |
27 |
| - Kitchen::RakeTasks.new |
28 |
| - |
29 |
| - desc 'Run all test instances' |
30 |
| - task :kitchen => ['kitchen:all'] |
31 |
| -rescue LoadError, NameError |
32 |
| - STDOUT.puts '[WARN] Kitchen::RakeTasks not loaded'.yellow |
33 |
| -end |
| 25 | +# begin |
| 26 | +# require 'kitchen/rake_tasks' |
| 27 | +# Kitchen::RakeTasks.new |
| 28 | +# |
| 29 | +# desc 'Run all test instances' |
| 30 | +# task :kitchen => ['kitchen:all'] |
| 31 | +# rescue LoadError, NameError |
| 32 | +# STDOUT.puts '[WARN] Kitchen::RakeTasks not loaded'.yellow |
| 33 | +# end |
| 34 | +# |
34 | 35 |
|
35 |
| -# TODO: from sudo cookboook: |
| 36 | +# # TODO: from sudo cookboook: |
36 | 37 | # Integration tests. Kitchen.ci
|
37 | 38 | namespace :integration do
|
38 |
| - desc 'Run Test Kitchen with Docker' |
39 |
| - task :docker do |
40 |
| - Kitchen.logger = Kitchen.default_file_logger |
41 |
| - Kitchen::Config.new.instances.each do |instance| |
42 |
| - instance.test(:always) |
43 |
| - end |
| 39 | + begin |
| 40 | + require 'kitchen' |
| 41 | + |
| 42 | + desc 'Run Test Kitchen integration tests with Docker' |
| 43 | + task :docker do |
| 44 | + Kitchen.logger = Kitchen.default_file_logger |
| 45 | + loader_config = { :local_config => '.kitchen.docker.yml' } |
| 46 | + config = { :loader => Kitchen::Loader::YAML.new(loader_config) } |
| 47 | + Kitchen::Config.new(config).instances.each do |instance| |
| 48 | + instance.test(:always) |
| 49 | + end |
| 50 | + end # task |
| 51 | + rescue LoadError, NameError |
| 52 | + STDOUT.puts '[WARN] Kitchen::RakeTasks not loaded'.yellow |
44 | 53 | end
|
45 | 54 | end
|
| 55 | + |
| 56 | +task :integration => %w(integration:docker) |
| 57 | + |
| 58 | +# where |
| 59 | +# integration:cloud |
| 60 | +# integration:local |
| 61 | +# integration:travis |
| 62 | + |
| 63 | +# how |
| 64 | +# integration:docker |
| 65 | +# integration:vagrant |
| 66 | +# integration:parallels |
| 67 | + |
| 68 | + |
| 69 | +# desc 'Run Test Kitchen integration tests' |
| 70 | +# namespace :integration do |
| 71 | +# # Gets a collection of instances. |
| 72 | +# # |
| 73 | +# # @param regexp [String] regular expression to match against instance names. |
| 74 | +# # @param config [Hash] configuration values for the `Kitchen::Config` class. |
| 75 | +# # @return [Collection<Instance>] all instances. |
| 76 | +# def kitchen_instances(regexp, config) |
| 77 | +# instances = Kitchen::Config.new(config).instances |
| 78 | +# return instances if regexp.nil? || regexp == 'all' |
| 79 | +# instances.get_all(Regexp.new(regexp)) |
| 80 | +# end |
| 81 | +# |
| 82 | +# # Runs a test kitchen action against some instances. |
| 83 | +# # |
| 84 | +# # @param action [String] kitchen action to run (defaults to `'test'`). |
| 85 | +# # @param regexp [String] regular expression to match against instance names. |
| 86 | +# # @param loader_config [Hash] loader configuration options. |
| 87 | +# # @return void |
| 88 | +# def run_kitchen(action, regexp, loader_config = {}) |
| 89 | +# action = 'test' if action.nil? |
| 90 | +# require 'kitchen' |
| 91 | +# Kitchen.logger = Kitchen.default_file_logger |
| 92 | +# config = { loader: Kitchen::Loader::YAML.new(loader_config) } |
| 93 | +# kitchen_instances(regexp, config).each { |i| i.send(action) } |
| 94 | +# end |
| 95 | +# |
| 96 | +# desc 'Run integration tests with kitchen-vagrant' |
| 97 | +# task :vagrant, [:regexp, :action] do |_t, args| |
| 98 | +# run_kitchen(args.action, args.regexp) |
| 99 | +# end |
| 100 | +# |
| 101 | +# desc 'Run integration tests with kitchen-docker' |
| 102 | +# task :docker, [:regexp, :action] do |_t, args| |
| 103 | +# run_kitchen(args.action, args.regexp, local_config: '.kitchen.docker.yml') |
| 104 | +# end |
| 105 | +# end |
| 106 | +# |
| 107 | +# task default: %w(integration:vagrant) |
0 commit comments