test-kitchen 1.0.0.alpha.1 → 1.0.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 1.0.0.alpha.2 / 2013-03-28
2
+
3
+ ### Bug fixes
4
+
5
+ * Remove catch-all rescue in Driver.for_plugin (reason provided in commit message). ([@fnichol][])
6
+
7
+ ### New features
8
+
9
+ * Add --log-level flag to CLI for test, create, converge, setup, verify, destroy, and login actions. The environment variable `KITCHEN_LOG` may still be used to also set the logging level. ([@fnichol][])
10
+ * Driver::SSHBase and subclass drivers now support setting a :port number in .kitchen.yml or in instance state. ([@fnichol][])
11
+
12
+ ### Improvements
13
+
14
+ * Support thor 0.16.0 and 0.17.0+. ([@fnichol][])
15
+ * Support SSH config from #state & #config in Driver::SSHBase, helping drivers such as kitchen-vagrant. ([@fnichol][])
16
+
17
+
1
18
  ## 1.0.0.alpha.1 / 2013-03-22
2
19
 
3
20
  ### Bug fixes
@@ -32,4 +49,4 @@ The initial release.
32
49
  [@ChrisLundquist]: https://github.com/ChrisLundquist
33
50
  [@fnichol]: https://github.com/fnichol
34
51
  [@mattray]: https://github.com/mattray
35
- [@reset]: https://github.com/reset
52
+ [@reset]: https://github.com/reset
@@ -12,19 +12,19 @@ Feature: Add Test Kitchen support to an existing project
12
12
  """
13
13
  And the exit status should be 0
14
14
 
15
- # Scenario: Running init with default values
16
- # Given a sandboxed GEM_HOME directory named "kitchen-init"
17
- # When I run `kitchen init`
18
- # Then the exit status should be 0
19
- # And a directory named ".kitchen" should exist
20
- # And a directory named "test/integration/default" should exist
21
- # And the file ".gitignore" should contain ".kitchen/"
22
- # And the file ".gitignore" should contain ".kitchen.local.yml"
23
- # And the file ".kitchen.yml" should contain "driver_plugin: vagrant"
24
- # And a file named "Gemfile" should not exist
25
- # And a file named "Rakefile" should not exist
26
- # And a file named "Thorfile" should not exist
27
- # And a gem named "kitchen-vagrant" is installed
15
+ Scenario: Running init with default values
16
+ Given a sandboxed GEM_HOME directory named "kitchen-init"
17
+ When I run `kitchen init`
18
+ Then the exit status should be 0
19
+ And a directory named ".kitchen" should exist
20
+ And a directory named "test/integration/default" should exist
21
+ And the file ".gitignore" should contain ".kitchen/"
22
+ And the file ".gitignore" should contain ".kitchen.local.yml"
23
+ And the file ".kitchen.yml" should contain "driver_plugin: vagrant"
24
+ And a file named "Gemfile" should not exist
25
+ And a file named "Rakefile" should not exist
26
+ And a file named "Thorfile" should not exist
27
+ And a gem named "kitchen-vagrant" is installed
28
28
 
29
29
  Scenario: Running init that creates a Gemfile
30
30
  When I successfully run `kitchen init --create-gemfile`
@@ -3,7 +3,7 @@ require 'aruba/cucumber'
3
3
  require 'kitchen'
4
4
 
5
5
  Before do
6
- @aruba_timeout_seconds = 5
6
+ @aruba_timeout_seconds = 15
7
7
  @cleanup_dirs = []
8
8
  end
9
9
 
data/lib/kitchen/cli.rb CHANGED
@@ -70,6 +70,8 @@ module Kitchen
70
70
  )
71
71
  method_option :parallel, :aliases => "-p", :type => :boolean,
72
72
  :desc => "Perform action against all matching instances in parallel"
73
+ method_option :log_level, :aliases => "-l",
74
+ :desc => "Set the log level (debug, info, warn, error, fatal)"
73
75
  define_method(action) { |*args| exec_action(action) }
74
76
  end
75
77
 
@@ -86,6 +88,8 @@ module Kitchen
86
88
  DESC
87
89
  method_option :parallel, :aliases => "-p", :type => :boolean,
88
90
  :desc => "Perform action against all matching instances in parallel"
91
+ method_option :log_level, :aliases => "-l",
92
+ :desc => "Set the log level (debug, info, warn, error, fatal)"
89
93
  method_option :destroy, :aliases => "-d", :default => "passing",
90
94
  :desc => "Destroy strategy to use after testing (passing, always, never)."
91
95
  def test(*args)
@@ -93,6 +97,7 @@ module Kitchen
93
97
  raise ArgumentError, "Destroy mode must be passing, always, or never."
94
98
  end
95
99
 
100
+ update_config!
96
101
  banner "Starting Kitchen"
97
102
  elapsed = Benchmark.measure do
98
103
  destroy_mode = options[:destroy].to_sym
@@ -109,7 +114,10 @@ module Kitchen
109
114
  end
110
115
 
111
116
  desc "login (['REGEX']|[INSTANCE])", "Log in to one instance"
117
+ method_option :log_level, :aliases => "-l",
118
+ :desc => "Set the log level (debug, info, warn, error, fatal)"
112
119
  def login(regexp)
120
+ update_config!
113
121
  results = get_filtered_instances(regexp)
114
122
  if results.size > 1
115
123
  die task, "Argument `#{regexp}' returned multiple results:\n" +
@@ -214,13 +222,14 @@ module Kitchen
214
222
  "driver", "Driver subcommands"
215
223
 
216
224
  no_tasks do
217
- def invoke_task(task, *args)
218
- if task.name == "help" && args.first.first == "driver"
225
+ def invoke_task(command, *args)
226
+ if command.name == "help" && args.first.first == "driver"
219
227
  Kitchen::CLI::Driver.task_help(shell, args.first.last)
220
228
  else
221
229
  super
222
230
  end
223
231
  end
232
+ alias_method :invoke_command, :invoke_task
224
233
  end
225
234
 
226
235
  private
@@ -232,6 +241,7 @@ module Kitchen
232
241
  end
233
242
 
234
243
  def exec_action(action)
244
+ update_config!
235
245
  banner "Starting Kitchen"
236
246
  elapsed = Benchmark.measure do
237
247
  @task = action
@@ -289,6 +299,12 @@ module Kitchen
289
299
  [set_color(instance.name, :white), action]
290
300
  end
291
301
 
302
+ def update_config!
303
+ if options[:log_level]
304
+ @config.log_level = options[:log_level].downcase.to_sym
305
+ end
306
+ end
307
+
292
308
  def die(task, msg)
293
309
  error "\n#{msg}\n\n"
294
310
  help(task)
@@ -37,8 +37,6 @@ module Kitchen
37
37
  raise
38
38
  rescue LoadError
39
39
  raise ClientError, "Could not require '#{plugin}' plugin from load path"
40
- rescue
41
- raise ClientError, "Failed to create a driver for '#{plugin}' plugin"
42
40
  end
43
41
  end
44
42
  end
@@ -66,10 +66,14 @@ module Kitchen
66
66
  end
67
67
 
68
68
  def login_command(state)
69
+ combined = config.merge(state)
70
+
69
71
  args = %W{ -o UserKnownHostsFile=/dev/null }
70
72
  args += %W{ -o StrictHostKeyChecking=no }
71
- args += %W{ -i #{config[:ssh_key]}} if config[:ssh_key]
72
- args += %W{ #{config[:username]}@#{state[:hostname]}}
73
+ args += %W{ -o LogLevel=#{logger.debug? ? "VERBOSE" : "ERROR"} }
74
+ args += %W{ -i #{combined[:ssh_key]}} if combined[:ssh_key]
75
+ args += %W{ -p #{combined[:port]}} if combined[:port]
76
+ args += %W{ #{combined[:username]}@#{combined[:hostname]}}
73
77
 
74
78
  Driver::LoginCommand.new(["ssh", *args])
75
79
  end
@@ -77,13 +81,16 @@ module Kitchen
77
81
  protected
78
82
 
79
83
  def build_ssh_args(state)
84
+ combined = config.merge(state)
85
+
80
86
  opts = Hash.new
81
87
  opts[:user_known_hosts_file] = "/dev/null"
82
88
  opts[:paranoid] = false
83
- opts[:password] = config[:password] if config[:password]
84
- opts[:keys] = Array(config[:ssh_key]) if config[:ssh_key]
89
+ opts[:password] = combined[:password] if combined[:password]
90
+ opts[:port] = combined[:port] if combined[:port]
91
+ opts[:keys] = Array(combined[:ssh_key]) if combined[:ssh_key]
85
92
 
86
- [state[:hostname], config[:username], opts]
93
+ [combined[:hostname], combined[:username], opts]
87
94
  end
88
95
 
89
96
  def chef_home
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Kitchen
20
20
 
21
- VERSION = "1.0.0.alpha.1"
21
+ VERSION = "1.0.0.alpha.2"
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.1
4
+ version: 1.0.0.alpha.2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-23 00:00:00.000000000 Z
12
+ date: 2013-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid