kitchen-localhost 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 603280763cd44c569d0979c3bda268dfb70e6e5a
4
- data.tar.gz: 03d6fa925bc3d7aa675a2d0593de9959349670e0
3
+ metadata.gz: 34a54cce816185c98766b75a8b87fbd38677418f
4
+ data.tar.gz: b02ef1f249dc4107d3d589940995a56bce2df255
5
5
  SHA512:
6
- metadata.gz: 9997708c0e3225cb5af120ce333767445f558febdbd8b59a561e6bb10e0026e8e2d76aa0f19459b86b867093a744263fad58e3de5c1a6df25704a6b1d4c00da8
7
- data.tar.gz: 96a5324fb1fd97b3ea946d6ef91412186a71a91407e3b9d8772610f4b785710c941792f4bf376c539dc75069515cf0cd75c4ea6eff4f05958842f572fb40f1ac
6
+ metadata.gz: b2a53692d0a32a238e7a05bc3e4cbe45033a5e74b8d8703054309a93a0b78299b6da601b4f64d60cc93c8e788a2562f8fbad2cb859a775a919b8e103bf5bcb01
7
+ data.tar.gz: ba7c44f78e10903888be572d4fc1f4a3032974263d299d31a7baaf70ae2f613c0700ca77625baa6c6df8ac082c08d4ab34c0398b6c6be4ff451319b400070a78
data/.kitchen.yml CHANGED
@@ -9,9 +9,9 @@ platforms:
9
9
  - name: localhost
10
10
 
11
11
  suites:
12
- - name: tempfile
12
+ - name: create_file
13
13
  run_list:
14
- - recipe[kitchen-localhost-test]
15
- attributes:
16
- kitchen_localhost_test:
17
- test_file: testing_kitchen_localhost
14
+ - recipe[kitchen-localhost-test::create_file]
15
+ - name: delete_file
16
+ run_list:
17
+ - recipe[kitchen-localhost-test::delete_file]
data/.travis.yml CHANGED
@@ -4,7 +4,7 @@ cache: bundler
4
4
  sudo: true
5
5
 
6
6
  script:
7
- - bundle exec rake && bundle exec rake kitchen:all
7
+ - bundle exec rake && bundle exec kitchen test -c 2
8
8
 
9
9
  rvm:
10
10
  - ruby-head
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Kitchen-Localhost CHANGELOG
2
2
  ===========================
3
3
 
4
+ v0.2.0 (2015-05-31)
5
+ -------------------
6
+ * Try to catch instances where Kitchen is running in concurrency mode and force
7
+ instances of this driver to run serially.
8
+
4
9
  v0.1.1 (2015-04-29)
5
10
  -------------------
6
11
  * Bump Kitchen dependency to the final 1.4 release
data/README.md CHANGED
@@ -29,6 +29,10 @@ understanding that this driver will be running against _your local machine_. If
29
29
  you write a cookbook that formats a hard drive and run it with this driver, bad
30
30
  things will happen.
31
31
 
32
+ Also note that this driver's very nature makes it likely there will be problems
33
+ if you try to do a Test Kitchen run with multiple suites and/or with
34
+ concurrency enabled.
35
+
32
36
  Installation and Setup
33
37
  ----------------------
34
38
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.authors = ['Jonathan Hartman']
11
11
  spec.email = %w(j@p4nt5.com)
12
12
  spec.description = 'A Test Kitchen Driver for localhost'
13
- spec.summary = 'Use Test Kitchen to run Chef on your local machine!'
13
+ spec.summary = 'Use Test Kitchen on your local machine!'
14
14
  spec.homepage = 'https://github.com/test-kitchen/kitchen-localhost'
15
15
  spec.license = 'Apache 2.0'
16
16
 
@@ -31,14 +31,42 @@ module Kitchen
31
31
  # @author Jonathan Hartman <j@p4nt5.com>
32
32
  class Localhost < Kitchen::Driver::Base
33
33
  kitchen_driver_api_version 2
34
-
35
34
  plugin_version Kitchen::Localhost::VERSION
36
35
 
36
+ #
37
+ # Define a Mutex at the class level so we can prevent instances using
38
+ # this driver from colliding.
39
+ #
40
+ # @return [Mutex]
41
+ #
42
+ def self.lock
43
+ @lock ||= Mutex.new
44
+ end
45
+
46
+ #
47
+ # Lock the class-level Mutex, whatever state it's in currently.
48
+ #
49
+ def self.lock!
50
+ lock.lock
51
+ end
52
+
53
+ #
54
+ # Unlock the class-level Mutex, whatever state it's in currently.
55
+ #
56
+ def self.unlock!
57
+ # Mutex#unlock raises an exception if lock is owned by another thread
58
+ # and Mutex#owned? isn't available in Ruby 1.9.
59
+ lock.unlock if lock.locked?
60
+ rescue ThreadError
61
+ nil
62
+ end
63
+
37
64
  #
38
65
  # Create the temp dirs on the local filesystem for Kitchen.
39
66
  #
40
67
  # (see Base#create)
41
68
  def create(state)
69
+ self.class.lock!
42
70
  state[:hostname] = Socket.gethostname
43
71
  logger.info("[Localhost] Instance #{instance} ready.")
44
72
  end
@@ -56,6 +84,7 @@ module Kitchen
56
84
  FileUtils.rm_rf(p)
57
85
  logger.info("[Localhost] Deleted temp dir '#{p}'.")
58
86
  end
87
+ self.class.unlock!
59
88
  end
60
89
  end
61
90
  end
@@ -22,6 +22,6 @@ module Kitchen
22
22
  #
23
23
  # @author Jonathan Hartman <j@p4nt5.com>
24
24
  module Localhost
25
- VERSION = '0.1.1'
25
+ VERSION = '0.2.0'
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-localhost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hartman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -210,6 +210,6 @@ rubyforge_project:
210
210
  rubygems_version: 2.4.6
211
211
  signing_key:
212
212
  specification_version: 4
213
- summary: Use Test Kitchen to run Chef on your local machine!
213
+ summary: Use Test Kitchen on your local machine!
214
214
  test_files: []
215
215
  has_rdoc: