Skip to content

Commit c14dbac

Browse files
committed
spec: starting a container
1 parent 8119960 commit c14dbac

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

spec/all.rb

+24-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'pry'
33

44
build_path = File.expand_path File.join(File.dirname(__FILE__), '..')
5-
image_tag = 'test_klevo/percona'
5+
image_tag = 'klevo/percona'
66

77
describe "image" do
88
before(:all) do
@@ -11,11 +11,32 @@
1111
end
1212

1313
it "should expose the mysql tcp port" do
14-
# binding.pry
1514
expect(@image.json["Config"]["ExposedPorts"]).to include("3306/tcp")
1615
end
1716

1817
after(:all) do
19-
# @image.remove
18+
end
19+
end
20+
21+
describe "running container" do
22+
before(:all) do
23+
@image = Docker::Image.build_from_dir build_path, t: image_tag
24+
end
25+
26+
it "will start and run mysql daemon" do
27+
@container = Docker::Container.create(
28+
'Image' => image_tag,
29+
'Detach' => true,
30+
'Env' => [ 'MYSQL_ROOT_PASSWORD=something' ]
31+
)
32+
@container.start
33+
root_my_cnf = @container.exec(['bash', '-c', 'cat /root/.my.cnf'])
34+
expect(root_my_cnf.first.first).to match(/password=something/)
35+
36+
# binding.pry
37+
end
38+
39+
after(:all) do
40+
@container.delete(force: true)
2041
end
2142
end

0 commit comments

Comments
 (0)