kitchen-docker 0.1.1.dev → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -11
- data/lib/kitchen/driver/docker.rb +14 -5
- data/lib/kitchen/driver/docker_version.rb +1 -1
- metadata +8 -5
data/README.md
CHANGED
@@ -4,9 +4,7 @@ A Test Kitchen Driver for Docker.
|
|
4
4
|
|
5
5
|
## <a name="requirements"></a> Requirements
|
6
6
|
|
7
|
-
|
8
|
-
use this driver. Implement the `#verify_dependencies` method in your Driver
|
9
|
-
class to enforce these requirements in code, if possible.
|
7
|
+
* [Docker][docker_getting_started]
|
10
8
|
|
11
9
|
## <a name="installation"></a> Installation and Setup
|
12
10
|
|
@@ -14,7 +12,22 @@ Please read the [Driver usage][driver_usage] page for more details.
|
|
14
12
|
|
15
13
|
## <a name="config"></a> Configuration
|
16
14
|
|
17
|
-
|
15
|
+
### <a name="config-image"></a> image
|
16
|
+
|
17
|
+
The Docker image to use as the base for the suite containers. You can find
|
18
|
+
images using the [Docker Index][docker_index].
|
19
|
+
|
20
|
+
The default value is `ubuntu` ([image][docker_default_image]).
|
21
|
+
|
22
|
+
### <a name="config-platform"></a> platform
|
23
|
+
|
24
|
+
The platform of the chosen image. This is used to properly bootstrap the
|
25
|
+
suite container for Test Kitchen. Kitchen Docker currently supports:
|
26
|
+
|
27
|
+
* `debian` or `ubuntu`
|
28
|
+
* `rhel` or `centos`
|
29
|
+
|
30
|
+
The default value is `ubuntu`.
|
18
31
|
|
19
32
|
### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
|
20
33
|
|
@@ -30,7 +43,7 @@ installed. There are several different behaviors available:
|
|
30
43
|
the installed version and the desired version match.
|
31
44
|
* `false` or `nil` - no chef is installed.
|
32
45
|
|
33
|
-
The default value is
|
46
|
+
The default value is `true`.
|
34
47
|
|
35
48
|
## <a name="development"></a> Development
|
36
49
|
|
@@ -56,9 +69,12 @@ Created and maintained by [Sean Porter][author] (<portertech@gmail.com>)
|
|
56
69
|
Apache 2.0 (see [LICENSE][license])
|
57
70
|
|
58
71
|
|
59
|
-
[author]:
|
60
|
-
[issues]:
|
61
|
-
[license]:
|
62
|
-
[repo]:
|
63
|
-
[
|
64
|
-
[
|
72
|
+
[author]: https://github.com/portertech
|
73
|
+
[issues]: https://github.com/portertech/kitchen-docker/issues
|
74
|
+
[license]: https://github.com/portertech/kitchen-docker/blob/master/LICENSE
|
75
|
+
[repo]: https://github.com/portertech/kitchen-docker
|
76
|
+
[docker_getting_started]: http://www.docker.io/gettingstarted/
|
77
|
+
[docker_index]: https://index.docker.io/
|
78
|
+
[docker_default_image]: https://index.docker.io/_/ubuntu/
|
79
|
+
[driver_usage]: http://docs.kitchen-ci.org/drivers/usage
|
80
|
+
[chef_omnibus_dl]: http://www.opscode.com/chef/install/
|
@@ -33,7 +33,14 @@ module Kitchen
|
|
33
33
|
default_config :port, '22'
|
34
34
|
default_config :username, 'kitchen'
|
35
35
|
default_config :password, 'kitchen'
|
36
|
-
default_config :require_chef_omnibus,
|
36
|
+
default_config :require_chef_omnibus, true
|
37
|
+
|
38
|
+
def verify_dependencies
|
39
|
+
run_command('docker > /dev/null', :quiet => true)
|
40
|
+
rescue
|
41
|
+
raise UserError,
|
42
|
+
'You must first install Docker http://www.docker.io/gettingstarted/'
|
43
|
+
end
|
37
44
|
|
38
45
|
def create(state)
|
39
46
|
state[:image_id] = build_image(state) unless state[:image_id]
|
@@ -70,12 +77,14 @@ module Kitchen
|
|
70
77
|
raise ActionFailed,
|
71
78
|
"Unknown platform '#{config[:platform]}'"
|
72
79
|
end
|
80
|
+
username = config[:username]
|
81
|
+
password = config[:password]
|
73
82
|
base = <<-eos
|
74
83
|
RUN mkdir /var/run/sshd
|
75
84
|
RUN echo '127.0.0.1 localhost.localdomain localhost' >> /etc/hosts
|
76
|
-
RUN useradd -d /home
|
77
|
-
RUN echo
|
78
|
-
RUN echo '
|
85
|
+
RUN useradd -d /home/#{username} -m -s /bin/bash #{username}
|
86
|
+
RUN echo #{username}:#{password} | chpasswd
|
87
|
+
RUN echo '#{username} ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
79
88
|
eos
|
80
89
|
[from, platform, base].join("\n")
|
81
90
|
end
|
@@ -121,7 +130,7 @@ module Kitchen
|
|
121
130
|
|
122
131
|
def container_address(state)
|
123
132
|
container_id = state[:container_id]
|
124
|
-
output = run_command("docker inspect #{container_id}"
|
133
|
+
output = run_command("docker inspect #{container_id}")
|
125
134
|
parse_container_ip(output)
|
126
135
|
end
|
127
136
|
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Sean Porter
|
@@ -137,16 +137,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
137
|
requirements:
|
138
138
|
- - ! '>='
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
hash:
|
140
|
+
hash: 1503263599404936680
|
141
141
|
version: '0'
|
142
142
|
segments:
|
143
143
|
- 0
|
144
144
|
none: false
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
|
-
- - ! '
|
147
|
+
- - ! '>='
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
|
149
|
+
hash: 1503263599404936680
|
150
|
+
version: '0'
|
151
|
+
segments:
|
152
|
+
- 0
|
150
153
|
none: false
|
151
154
|
requirements: []
|
152
155
|
rubyforge_project:
|