-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcontainer_without_volume.rb
37 lines (31 loc) · 1.17 KB
/
container_without_volume.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'spec_helper'
describe "running a container without attached volumes" do
before :all do
@container = Docker::Container.create(
'Image' => IMAGE_TAG,
'Detach' => true,
'Env' => [ 'MYSQL_ROOT_PASSWORD=something' ]
)
@container.start
# ap @container.json
@container.exec(['bash', '-c', 'mysqladmin --silent --wait=30 ping'])
end
it "has root .my.cnf file that contains the password specified on container create" do
root_my_cnf = @container.exec(['bash', '-c', 'cat /root/.my.cnf']).first.first
expect(root_my_cnf).to match(/password=something/)
end
it "runs mysql daemon" do
stdout, stderr = @container.exec(['bash', '-c', 'ps aux'])
expect(stdout.first).to match(/\/usr\/sbin\/mysqld/)
end
it "can run mysql query through build in mysql client" do
stdout, stderr = @container.exec(['bash', '-c', 'mysql -e "show databases;"'])
expect(stderr.first).to_not match(/Access denied for user/)
expect(stdout.first).to match(/mysql/)
expect(stdout.first).to match(/information_schema/)
expect(stdout.first).to_not match(/test/)
end
after :all do
@container.delete(force: true, v: true)
end
end