2014-02-15 18:06:49 -05:00
|
|
|
Shindo.tests("Fog::Compute[:fogdocker] | container_action request", 'fogdocker') do
|
|
|
|
|
|
|
|
compute = Fog::Compute[:fogdocker]
|
|
|
|
name = "fog-#{Time.now.to_i}"
|
2014-10-16 06:40:58 -04:00
|
|
|
response = compute.container_create(:name => name, 'image' => 'mattdm/fedora:f19','Cmd' => ['date'])
|
2014-02-15 18:06:49 -05:00
|
|
|
id = response['id']
|
|
|
|
|
2014-03-05 12:08:48 -05:00
|
|
|
tests("Start Container") do
|
2014-10-16 06:40:58 -04:00
|
|
|
response = compute.container_action(:id => id, :action => :start)
|
|
|
|
test("should be a kind of Hash") { response.kind_of? Hash }
|
|
|
|
test("should be running") { response['state_running'] == true }
|
2014-02-15 18:06:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("Stop Container") do
|
2014-10-16 06:40:58 -04:00
|
|
|
response = compute.container_action(:id => id, :action => :stop)
|
|
|
|
test("should be a kind of Hash") { response.kind_of? Hash }
|
2014-02-15 18:06:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("Kill Container") do
|
2014-10-16 06:40:58 -04:00
|
|
|
response = compute.container_action(:id => id, :action => :kill)
|
|
|
|
test("should be a kind of Hash") { response.kind_of? Hash }
|
|
|
|
test("should be stopped") { response['state_running'] == false }
|
2014-02-15 18:06:49 -05:00
|
|
|
end
|
|
|
|
|
2014-10-16 06:40:58 -04:00
|
|
|
tests("Top Container") do
|
|
|
|
response = compute.container_action(:id => id, :action => :top)
|
|
|
|
test("should be an Array") { response.kind_of? Array }
|
|
|
|
test("should be an array of processes") { !!(response.first['PID'] =~ /^\d+$/) }
|
|
|
|
end
|
|
|
|
|
|
|
|
tests("Logs Container") do
|
|
|
|
response = compute.container_action(:id => id, :action => :logs)
|
|
|
|
test("should be a String") { response.kind_of? String }
|
|
|
|
end
|
2014-02-15 18:06:49 -05:00
|
|
|
end
|