On Thu, 2012-12-13 at 12:45 +0100, [email protected] wrote:
> From: Michal Fojtik <[email protected]>
> 
> - Starts a Deltacloud APi instance on port 3011
> - Checks if DC is running (respond to HTTP requests)
> - Checks if DC could be started with multiple frontends

Unfortunately, I get 3 failures with this test; seems that killing the
server isn't always successful. Here's what fails:

> diff --git a/server/tests/deltacloud/launcher_test.rb 
> b/server/tests/deltacloud/launcher_test.rb
> new file mode 100644
> index 0000000..3c9c0b1
> --- /dev/null
> +++ b/server/tests/deltacloud/launcher_test.rb
> @@ -0,0 +1,101 @@

> +describe "deltacloudd" do
> +
> +  before do
> +    @pids ||= []
> +  end
> +
> +  it 'starts the deltacloud server gracefully' do
> +    pid = Process.fork
> +    if pid.nil? then
> +      Dir.chdir(File.join(File.dirname(__FILE__), '..', '..'))
> +      exec("./bin/deltacloudd -i mock -p 3011")
> +    else
> +      Process.detach(pid) && @pids << pid
> +      wait_for_port_open(3011).must_equal true
> +      RestClient.get('http://localhost:3011/api').code.must_equal 200
> +      kill_process(pid)
> +      is_port_open?('127.0.0.1', 3011).must_equal false

This returns true.

> +    end
> +  end
> +
> +  it 'starts the deltacloud server gracefully with multiple frontends' do
> +    pid = Process.fork
> +    if pid.nil? then
> +      Dir.chdir(File.join(File.dirname(__FILE__), '..', '..'))
> +      exec("./bin/deltacloudd -i mock -f deltacloud,cimi,ec2 -p 3011")
> +    else
> +      Process.detach(pid) && @pids << pid
> +      wait_for_port_open(3011).must_equal true
> +      RestClient.get('http://localhost:3011/api').code.must_equal 200
> +      
> RestClient.get('http://localhost:3011/cimi/cloudEntryPoint').code.must_equal 
> 200
> +      kill_process(pid)
> +      is_port_open?('127.0.0.1', 3011).must_equal false

Returns true

> +    end
> +  end
> +
> +  it 'starts the deltacloud server gracefully when using webrick' do
> +    pid = Process.fork
> +    if pid.nil? then
> +      Dir.chdir(File.join(File.dirname(__FILE__), '..', '..'))
> +      exec("./bin/deltacloudd -w -i mock -p 3011")
> +    else
> +      Process.detach(pid) && @pids << pid
> +      wait_for_port_open(3011).must_equal true
> +      RestClient.get('http://localhost:3011/api').code.must_equal 200
> +      kill_process(pid)
> +      is_port_open?('127.0.0.1', 3011).must_equal false

Returns true

David


Reply via email to