Sha256: 6def2f3ebd102567dc7e65f3c639788afea0464cfb36c4a22d936d42e211f229

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

require 'master.rb'
require 'network_lookup.rb'

describe "Master Server" do
  it "should timeout clients after <n> seconds" do
    TestBed::testbeds.should == []
    m=MasterApp.new(nil,{})
    m.run
    sleep 0.3
    m.valid.should be_true
    n=NetworkLookupApp.new(nil,{})
    n.register(:client)
    m.clients.should == [:client]
    sleep 1
    n2=NetworkLookupApp.new(nil,{})
    n.register(:client2)
    m.clients.length.should <= 2
    
    (m.clients.sort).should == [:client,:client2]
    class MasterApp
      EXPIRE_SECONDS=1
    end
    m.clients.should == [:client2]
    sleep 1
    m.clients.should == []
    
    m.stop
    n.stop
    n2.stop
    TestBed::testbeds.should == []
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appswarm-0.0.1 apps/master/spec/master_spec.rb