Sha256: 86f3fabace1559dffd3e991c3e0f18128f542c21dc21604064c6421ec32bc66b

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe "Process Http check" do
  before :each do
    @c = C.p1.merge(
      :checks => C.check_http
    )
    FakeWeb.register_uri(:get, "http://localhost:3000/bla", :body => "Somebody OK")
  end

  after :each do
    FakeWeb.clean_registry
  end

  it "all ok" do
    start_ok_process(@c)

    dont_allow(@process).schedule(:restart)

    # should not happens anything
    sleep 6
  end

  it "bad body" do
    start_ok_process(@c)
    sleep 2

    mock(@process).schedule(:restart, anything)
    FakeWeb.register_uri(:get, "http://localhost:3000/bla", :body => "Somebody BAD")
    sleep 2
  end

  it "bad status" do
    start_ok_process(@c)
    sleep 2

    mock(@process).schedule(:restart, anything)
    FakeWeb.register_uri(:get, "http://localhost:3000/bla", :body => "Somebody OK", :status => [500, 'err'])
    sleep 2
  end

  it "not responded url" do
    start_ok_process(@c)
    sleep 2

    mock(@process).schedule(:restart, anything)
    FakeWeb.clean_registry
    FakeWeb.allow_net_connect = false
    sleep 2
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
eye-0.2.4 spec/process/checks/http_spec.rb
eye-0.2.3 spec/process/checks/http_spec.rb
eye-0.2.2 spec/process/checks/http_spec.rb
eye-0.2.1 spec/process/checks/http_spec.rb
eye-0.2 spec/process/checks/http_spec.rb
eye-0.1.11 spec/process/checks/http_spec.rb