Skip to content

Commit e13d3b2

Browse files
bryanwbjtimberman
authored andcommitted
add test-kitchen tests and basic configuration
1 parent 57225e3 commit e13d3b2

5 files changed

Lines changed: 174 additions & 0 deletions

File tree

Gemfile.lock

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
archive-tar-minitar (0.5.2)
5+
bunny (0.8.0)
6+
chef (10.12.0)
7+
bunny (>= 0.6.0)
8+
erubis
9+
highline (>= 1.6.9)
10+
json (>= 1.4.4, <= 1.6.1)
11+
mixlib-authentication (>= 1.1.0)
12+
mixlib-cli (>= 1.1.0)
13+
mixlib-config (>= 1.1.2)
14+
mixlib-log (>= 1.3.0)
15+
mixlib-shellout
16+
moneta
17+
net-ssh (~> 2.2.2)
18+
net-ssh-multi (~> 1.1.0)
19+
ohai (>= 0.6.0)
20+
rest-client (>= 1.0.4, < 1.7.0)
21+
treetop (~> 1.4.9)
22+
uuidtools
23+
yajl-ruby (~> 1.1)
24+
childprocess (0.3.5)
25+
ffi (~> 1.0, >= 1.0.6)
26+
coderay (1.0.7)
27+
erubis (2.7.0)
28+
ffi (1.1.5)
29+
foodcritic (1.6.1)
30+
erubis
31+
gherkin (~> 2.11.1)
32+
gist (~> 3.1.0)
33+
nokogiri (= 1.5.0)
34+
pry (~> 0.9.8.4)
35+
rak (~> 1.4)
36+
treetop (~> 1.4.10)
37+
yajl-ruby (~> 1.1.0)
38+
gherkin (2.11.1)
39+
json (>= 1.4.6)
40+
gist (3.1.0)
41+
hashr (0.0.22)
42+
highline (1.6.13)
43+
i18n (0.6.0)
44+
ipaddress (0.8.0)
45+
json (1.5.4)
46+
librarian (0.0.24)
47+
archive-tar-minitar (>= 0.5.2)
48+
chef (>= 0.10)
49+
highline
50+
thor (~> 0.15)
51+
log4r (1.1.10)
52+
method_source (0.7.1)
53+
mime-types (1.19)
54+
mixlib-authentication (1.3.0)
55+
mixlib-log
56+
mixlib-cli (1.2.2)
57+
mixlib-config (1.1.2)
58+
mixlib-log (1.4.1)
59+
mixlib-shellout (1.1.0)
60+
moneta (0.6.0)
61+
net-scp (1.0.4)
62+
net-ssh (>= 1.99.1)
63+
net-ssh (2.2.2)
64+
net-ssh-gateway (1.1.0)
65+
net-ssh (>= 1.99.1)
66+
net-ssh-multi (1.1)
67+
net-ssh (>= 2.1.4)
68+
net-ssh-gateway (>= 0.99.0)
69+
nokogiri (1.5.0)
70+
ohai (6.14.0)
71+
ipaddress
72+
mixlib-cli
73+
mixlib-config
74+
mixlib-log
75+
systemu
76+
yajl-ruby
77+
polyglot (0.3.3)
78+
pry (0.9.8.4)
79+
coderay (~> 1.0.5)
80+
method_source (~> 0.7.1)
81+
slop (>= 2.4.4, < 3)
82+
rak (1.4)
83+
rest-client (1.6.7)
84+
mime-types (>= 1.16)
85+
slop (2.4.4)
86+
systemu (2.5.2)
87+
test-kitchen (0.5.4)
88+
foodcritic (~> 1.4)
89+
hashr (~> 0.0.20)
90+
highline (>= 1.6.9)
91+
librarian (~> 0.0.20)
92+
mixlib-cli (~> 1.2.2)
93+
vagrant (~> 1.0.2)
94+
yajl-ruby (~> 1.1.0)
95+
thor (0.16.0)
96+
treetop (1.4.10)
97+
polyglot
98+
polyglot (>= 0.3.1)
99+
uuidtools (2.1.3)
100+
vagrant (1.0.3)
101+
archive-tar-minitar (= 0.5.2)
102+
childprocess (~> 0.3.1)
103+
erubis (~> 2.7.0)
104+
i18n (~> 0.6.0)
105+
json (~> 1.5.1)
106+
log4r (~> 1.1.9)
107+
net-scp (~> 1.0.4)
108+
net-ssh (~> 2.2.2)
109+
yajl-ruby (1.1.0)
110+
111+
PLATFORMS
112+
ruby
113+
114+
DEPENDENCIES
115+
test-kitchen

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ To install Oracle flavored Java on Debian or Ubuntu override the `node['java']['
185185
"recipe[java]"
186186
)
187187

188+
Development
189+
===========
190+
191+
This cookbook uses
192+
[test-kitchen](https://github.com/opscode/test-kitchen) for
193+
integration tests. Pull requests should pass existing tests in
194+
files/default/tests/minitest-handler. Additional tests are always welcome.
195+
188196
License and Author
189197
==================
190198

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'minitest/spec'
2+
require 'open3'
3+
4+
describe_recipe 'java::openjdk' do
5+
6+
7+
include MiniTest::Chef::Assertions
8+
include MiniTest::Chef::Context
9+
include MiniTest::Chef::Resources
10+
11+
it "installs the correct version of the jdk" do
12+
stdin,stdout,stderr = Open3.popen3( "java -version" )
13+
version_line = stderr.readline
14+
jdk_version = version_line.scan(/\.([678])\./)[0][0]
15+
assert_equal node['java']['jdk_version'], jdk_version
16+
end
17+
18+
it "properly sets JAVA_HOME environment variable" do
19+
stdin,stdout,stderr = Open3.popen3( "echo $JAVA_HOME" )
20+
java_home = stdout.readline.rstrip
21+
assert_equal node['java']['java_home'], java_home
22+
end
23+
24+
end
25+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
require 'minitest/spec'
2+
require 'open3'
3+
4+
describe_recipe 'java::oracle' do
5+
6+
7+
include MiniTest::Chef::Assertions
8+
include MiniTest::Chef::Context
9+
include MiniTest::Chef::Resources
10+
11+
it "installs the correct version of the jdk" do
12+
stdin,stdout,stderr = Open3.popen3( "java -version" )
13+
version_line = stderr.readline
14+
jdk_version = version_line.scan(/\.([678])\./)[0][0]
15+
assert_equal node['java']['jdk_version'], jdk_version
16+
end
17+
18+
it "properly sets JAVA_HOME environment variable" do
19+
stdin,stdout,stderr = Open3.popen3( "echo $JAVA_HOME" )
20+
java_home = stdout.readline.rstrip
21+
assert_equal node['java']['java_home'], java_home
22+
end
23+
24+
end

test/kitchen/Kitchenfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
cookbook "java" do
2+
configuration("openjdk"){ runtimes [] }
3+
configuration("oracle"){ runtimes [] }
24
runtimes []
35
end

0 commit comments

Comments
 (0)