loggregator_emitter 0.0.8.pre → 0.0.9.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- loggregator_emitter (0.0.8.pre)
4
+ loggregator_emitter (0.0.9.pre)
5
5
  loggregator_messages (~> 0.0.1.pre)
6
6
 
7
7
  GEM
@@ -5,7 +5,8 @@ module LoggregatorEmitter
5
5
  class Emitter
6
6
  def initialize(loggregator_server, source_type)
7
7
  host, port = loggregator_server.split(":")
8
- raise RuntimeError, "Must provid validate loggregator server: #{loggregator_server}" if (host == nil || port == nil)
8
+ raise RuntimeError, "Must provide valid loggregator server: #{loggregator_server}" if (host == nil || port == nil)
9
+ raise RuntimeError, "Must provide IP address for loggregator server: #{loggregator_server}" unless host.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
9
10
  @sockaddr_in = Socket.sockaddr_in(port, host)
10
11
 
11
12
  raise RuntimeError, "Must provide valid source type" unless valid_source_type?(source_type)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "loggregator_emitter"
5
- spec.version = '0.0.8.pre'
5
+ spec.version = '0.0.9.pre'
6
6
  spec.authors = ["Pivotal"]
7
7
  spec.email = ["cf-eng@pivotallabs.com"]
8
8
  spec.description = "Library to emit data to Loggregator"
@@ -20,6 +20,14 @@ describe LoggregatorEmitter do
20
20
  it 'raises if source_type is invalid' do
21
21
  expect { LoggregatorEmitter::Emitter.new('0.0.0.0:12345', 40) }.to raise_error(RuntimeError)
22
22
  end
23
+
24
+ it 'raises if host is not ip is invalid' do
25
+ expect { LoggregatorEmitter::Emitter.new('localhost:12345', 40) }.to raise_error(RuntimeError)
26
+ end
27
+
28
+ it 'raises if host has protocol' do
29
+ expect { LoggregatorEmitter::Emitter.new('http://0.0.0.0:12345', 40) }.to raise_error(RuntimeError)
30
+ end
23
31
  end
24
32
 
25
33
  describe 'Sending To STDOUT' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggregator_emitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.pre
4
+ version: 0.0.9.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-27 00:00:00.000000000 Z
12
+ date: 2013-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: loggregator_messages