Sha256: 49c3bb25efbc3c781aaf2f29b50e36cdb9ef46217f213fde5f561ad02f46f612

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'
require 'flydata/compatibility_check'

module Flydata
  describe AgentCompatibilityCheck do
    let(:default_data_port) do
      {
        "servers"=>["sample-test-site.com"]
      }
     end

    describe "#check" do
      subject { AgentCompatibilityCheck.new("servers" => ['localhost']) }
      context "runs all check methods" do
        context "when all ports are accessible" do
          let(:sock) { double('sock') }
          before do
            allow(TCPSocket).to receive(:new).and_return(sock)
            allow(sock).to receive(:close)
          end
          it "does nothing" do
            subject.check
          end
        end
        context "when a port access fails" do
          before do
            allow(TCPSocket).to receive(:new).and_raise(Errno::ETIMEDOUT)
          end
          it do
            expect{subject.check_outgoing_ports}.to raise_error(Flydata::AgentCompatibilityCheck::AgentCompatibilityError, /ports/)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flydata-0.2.22 spec/flydata/compatibility_check_spec.rb
flydata-0.2.21 spec/flydata/compatibility_check_spec.rb
flydata-0.2.20 spec/flydata/compatibility_check_spec.rb