kitchen-docker 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +65 -12
- data/lib/kitchen/driver/docker.rb +15 -8
- data/lib/kitchen/driver/docker_version.rb +1 -1
- metadata +29 -34
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# Kitchen::Docker
|
2
2
|
|
3
3
|
A Test Kitchen Driver for Docker.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Requirements
|
6
6
|
|
7
7
|
* [Docker][docker_getting_started]
|
8
8
|
|
9
|
-
##
|
9
|
+
## Known Issues
|
10
10
|
|
11
11
|
* Upstart is neutered due to [this issue][docker_upstart_issue].
|
12
12
|
|
13
|
-
##
|
13
|
+
## Installation and Setup
|
14
14
|
|
15
15
|
Please read the [Driver usage][driver_usage] page for more details.
|
16
16
|
|
@@ -32,16 +32,16 @@ platforms:
|
|
32
32
|
- recipe[yum]
|
33
33
|
```
|
34
34
|
|
35
|
-
##
|
35
|
+
## Configuration
|
36
36
|
|
37
|
-
###
|
37
|
+
### image
|
38
38
|
|
39
39
|
The Docker image to use as the base for the suite containers. You can find
|
40
40
|
images using the [Docker Index][docker_index].
|
41
41
|
|
42
42
|
The default value is `base`, an official Ubuntu [image][docker_default_image].
|
43
43
|
|
44
|
-
###
|
44
|
+
### platform
|
45
45
|
|
46
46
|
The platform of the chosen image. This is used to properly bootstrap the
|
47
47
|
suite container for Test Kitchen. Kitchen Docker currently supports:
|
@@ -51,7 +51,7 @@ suite container for Test Kitchen. Kitchen Docker currently supports:
|
|
51
51
|
|
52
52
|
The default value is `ubuntu`.
|
53
53
|
|
54
|
-
###
|
54
|
+
### require\_chef\_omnibus
|
55
55
|
|
56
56
|
Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
|
57
57
|
installed. There are several different behaviors available:
|
@@ -67,7 +67,58 @@ installed. There are several different behaviors available:
|
|
67
67
|
|
68
68
|
The default value is `true`.
|
69
69
|
|
70
|
-
###
|
70
|
+
### remove\_images
|
71
|
+
|
72
|
+
This determines if images are automatically removed when the suite container is
|
73
|
+
destroyed.
|
74
|
+
|
75
|
+
The default value is `false`.
|
76
|
+
|
77
|
+
### memory
|
78
|
+
|
79
|
+
Sets the memory limit for the container. The value must be set in bytes.
|
80
|
+
If not, set it defaults to dockers default settings. You can read more about
|
81
|
+
`memory.limit_in_bytes` [here][memory_limit_in_bytes].
|
82
|
+
|
83
|
+
### cpu
|
84
|
+
|
85
|
+
Sets the cpu shares (relative weight). If not set, it defaults to dockers
|
86
|
+
default settings. You can read more about cpu.shares [here][cpu_shares].
|
87
|
+
|
88
|
+
### volume
|
89
|
+
|
90
|
+
Adds a data volume to your container.
|
91
|
+
|
92
|
+
Examples:
|
93
|
+
|
94
|
+
```
|
95
|
+
volume: /ftp
|
96
|
+
```
|
97
|
+
|
98
|
+
```
|
99
|
+
volume:
|
100
|
+
- /ftp
|
101
|
+
- /srv
|
102
|
+
```
|
103
|
+
|
104
|
+
## dns
|
105
|
+
|
106
|
+
Adjusts `resolv.conf` to use the dns servers specified. Otherwise use
|
107
|
+
dockers defaults.
|
108
|
+
|
109
|
+
Examples:
|
110
|
+
|
111
|
+
```
|
112
|
+
dns: 8.8.8.8
|
113
|
+
```
|
114
|
+
|
115
|
+
```
|
116
|
+
dns:
|
117
|
+
- 8.8.8.8
|
118
|
+
- 8.8.4.4
|
119
|
+
```
|
120
|
+
|
121
|
+
### forward
|
71
122
|
|
72
123
|
Suite container port(s) to forward to the host machine. You may specify
|
73
124
|
the host (public) port in the mappings, if not, Docker chooses for you.
|
@@ -84,7 +135,7 @@ forward:
|
|
84
135
|
- 80:8080
|
85
136
|
```
|
86
137
|
|
87
|
-
##
|
138
|
+
## Development
|
88
139
|
|
89
140
|
* Source hosted at [GitHub][repo]
|
90
141
|
* Report issues/questions/feature requests on [GitHub Issues][issues]
|
@@ -99,11 +150,11 @@ example:
|
|
99
150
|
4. Push to the branch (`git push origin my-new-feature`)
|
100
151
|
5. Create new Pull Request
|
101
152
|
|
102
|
-
##
|
153
|
+
## Authors
|
103
154
|
|
104
155
|
Created and maintained by [Sean Porter][author] (<portertech@gmail.com>)
|
105
156
|
|
106
|
-
##
|
157
|
+
## License
|
107
158
|
|
108
159
|
Apache 2.0 (see [LICENSE][license])
|
109
160
|
|
@@ -118,3 +169,5 @@ Apache 2.0 (see [LICENSE][license])
|
|
118
169
|
[docker_default_image]: https://index.docker.io/_/base/
|
119
170
|
[driver_usage]: http://docs.kitchen-ci.org/drivers/usage
|
120
171
|
[chef_omnibus_dl]: http://www.opscode.com/chef/install/
|
172
|
+
[cpu_shares]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpu.html
|
173
|
+
[memory_limit_in_bytes]: https://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-memory.html
|
@@ -18,6 +18,7 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
|
20
20
|
require 'kitchen'
|
21
|
+
require 'json'
|
21
22
|
|
22
23
|
module Kitchen
|
23
24
|
|
@@ -67,7 +68,7 @@ module Kitchen
|
|
67
68
|
<<-eos
|
68
69
|
ENV DEBIAN_FRONTEND noninteractive
|
69
70
|
RUN apt-get update
|
70
|
-
RUN apt-get install -y sudo openssh-server curl
|
71
|
+
RUN apt-get install -y sudo openssh-server curl lsb-release
|
71
72
|
RUN dpkg-divert --local --rename --add /sbin/initctl
|
72
73
|
RUN ln -s /bin/true /sbin/initctl
|
73
74
|
eos
|
@@ -118,20 +119,26 @@ module Kitchen
|
|
118
119
|
container_id
|
119
120
|
end
|
120
121
|
|
121
|
-
def
|
122
|
-
|
123
|
-
cmd
|
124
|
-
Array(config[:
|
125
|
-
|
126
|
-
|
122
|
+
def build_run_command(image_id)
|
123
|
+
cmd = 'docker run -d'
|
124
|
+
Array(config[:foward]).each {|port| cmd << " -p #{port}"}
|
125
|
+
Array(config[:dns]).each {|dns| cmd << " -dns #{dns}"}
|
126
|
+
Array(config[:volume]).each {|volume| cmd << " -v #{volume}"}
|
127
|
+
cmd << " -m #{config[:memory]}" if config[:memory]
|
128
|
+
cmd << " -c #{config[:cpu]}" if config[:cpu]
|
127
129
|
cmd << " #{image_id} /usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no"
|
130
|
+
cmd
|
131
|
+
end
|
132
|
+
|
133
|
+
def run_container(state)
|
134
|
+
cmd = build_run_command(state[:image_id])
|
128
135
|
output = run_command(cmd)
|
129
136
|
parse_container_id(output)
|
130
137
|
end
|
131
138
|
|
132
139
|
def parse_container_ip(output)
|
133
140
|
begin
|
134
|
-
info = Array(JSON.parse(output)).first
|
141
|
+
info = Array(::JSON.parse(output)).first
|
135
142
|
settings = info['NetworkSettings']
|
136
143
|
settings['IpAddress'] || settings['IPAddress']
|
137
144
|
rescue
|
metadata
CHANGED
@@ -1,112 +1,112 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
5
4
|
prerelease:
|
5
|
+
version: 0.4.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sean Porter
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
type: :runtime
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: 1.0.0.alpha.7
|
20
|
-
|
22
|
+
prerelease: false
|
21
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
22
25
|
requirements:
|
23
26
|
- - ~>
|
24
27
|
- !ruby/object:Gem::Version
|
25
28
|
version: 1.0.0.alpha.7
|
26
|
-
none: false
|
27
|
-
prerelease: false
|
28
29
|
name: test-kitchen
|
29
|
-
type: :runtime
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
+
type: :development
|
31
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
32
34
|
requirements:
|
33
35
|
- - ~>
|
34
36
|
- !ruby/object:Gem::Version
|
35
37
|
version: '1.3'
|
36
|
-
|
38
|
+
prerelease: false
|
37
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
38
41
|
requirements:
|
39
42
|
- - ~>
|
40
43
|
- !ruby/object:Gem::Version
|
41
44
|
version: '1.3'
|
42
|
-
none: false
|
43
|
-
prerelease: false
|
44
45
|
name: bundler
|
45
|
-
type: :development
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
+
type: :development
|
47
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
48
50
|
requirements:
|
49
51
|
- - ! '>='
|
50
52
|
- !ruby/object:Gem::Version
|
51
53
|
version: '0'
|
52
|
-
|
54
|
+
prerelease: false
|
53
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
54
57
|
requirements:
|
55
58
|
- - ! '>='
|
56
59
|
- !ruby/object:Gem::Version
|
57
60
|
version: '0'
|
58
|
-
none: false
|
59
|
-
prerelease: false
|
60
61
|
name: rake
|
61
|
-
type: :development
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
+
type: :development
|
63
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
64
66
|
requirements:
|
65
67
|
- - ! '>='
|
66
68
|
- !ruby/object:Gem::Version
|
67
69
|
version: '0'
|
68
|
-
|
70
|
+
prerelease: false
|
69
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
70
73
|
requirements:
|
71
74
|
- - ! '>='
|
72
75
|
- !ruby/object:Gem::Version
|
73
76
|
version: '0'
|
74
|
-
none: false
|
75
|
-
prerelease: false
|
76
77
|
name: cane
|
77
|
-
type: :development
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
+
type: :development
|
79
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
80
82
|
requirements:
|
81
83
|
- - ! '>='
|
82
84
|
- !ruby/object:Gem::Version
|
83
85
|
version: '0'
|
84
|
-
|
86
|
+
prerelease: false
|
85
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
86
89
|
requirements:
|
87
90
|
- - ! '>='
|
88
91
|
- !ruby/object:Gem::Version
|
89
92
|
version: '0'
|
90
|
-
none: false
|
91
|
-
prerelease: false
|
92
93
|
name: tailor
|
93
|
-
type: :development
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
+
type: :development
|
95
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
96
98
|
requirements:
|
97
99
|
- - ! '>='
|
98
100
|
- !ruby/object:Gem::Version
|
99
101
|
version: '0'
|
100
|
-
|
102
|
+
prerelease: false
|
101
103
|
version_requirements: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
102
105
|
requirements:
|
103
106
|
- - ! '>='
|
104
107
|
- !ruby/object:Gem::Version
|
105
108
|
version: '0'
|
106
|
-
none: false
|
107
|
-
prerelease: false
|
108
109
|
name: countloc
|
109
|
-
type: :development
|
110
110
|
description: A Test Kitchen Driver for Docker
|
111
111
|
email:
|
112
112
|
- portertech@gmail.com
|
@@ -134,23 +134,17 @@ rdoc_options: []
|
|
134
134
|
require_paths:
|
135
135
|
- lib
|
136
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
137
138
|
requirements:
|
138
139
|
- - ! '>='
|
139
140
|
- !ruby/object:Gem::Version
|
140
|
-
hash: 1226887042038828022
|
141
141
|
version: '0'
|
142
|
-
segments:
|
143
|
-
- 0
|
144
|
-
none: false
|
145
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
146
144
|
requirements:
|
147
145
|
- - ! '>='
|
148
146
|
- !ruby/object:Gem::Version
|
149
|
-
hash: 1226887042038828022
|
150
147
|
version: '0'
|
151
|
-
segments:
|
152
|
-
- 0
|
153
|
-
none: false
|
154
148
|
requirements: []
|
155
149
|
rubyforge_project:
|
156
150
|
rubygems_version: 1.8.24
|
@@ -158,3 +152,4 @@ signing_key:
|
|
158
152
|
specification_version: 3
|
159
153
|
summary: A Test Kitchen Driver for Docker
|
160
154
|
test_files: []
|
155
|
+
has_rdoc:
|