testotron 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/testotron.rb +11 -1
  3. data/lib/tests/http.rb +4 -2
  4. metadata +9 -13
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 82c1b1b254a39cc35e9960543e42fdae63825d71
4
+ data.tar.gz: 5bcbd3c78acc4f445ad5f696c70928b7c3b6cc1e
5
+ SHA512:
6
+ metadata.gz: 89d9a25a9ee77e0850bd2a9a202388e6926cea13db103cc48ad05aa223fb42727b54ffbe9d83126c47351a6c4482b7fb70e5571df600399b1b398b39c76b7959
7
+ data.tar.gz: 6c743d954549b131bc19049b9a6c7d29c804283c41b5f44d691bd89aaf61172bc1a3405680ffdaf8f0da38576157965112dbf3f3baeae80a9b5787f76c65fb65
data/lib/testotron.rb CHANGED
@@ -13,6 +13,7 @@ module Testotron
13
13
 
14
14
  class TestBuilder
15
15
  def initialize(runner)
16
+ @errors = false
16
17
  @runner = runner
17
18
  @report_methods = [ :local_mail ]
18
19
  end
@@ -29,7 +30,16 @@ module Testotron
29
30
  end
30
31
  }
31
32
 
33
+ def ok?
34
+ !@errors
35
+ end
36
+
37
+ def errors?
38
+ @errors
39
+ end
40
+
32
41
  def complain(test, failure)
42
+ @errors = true
33
43
  if @complaint_block
34
44
  @complaint_block.call(test, failure)
35
45
  end
@@ -110,7 +120,7 @@ EOF
110
120
  runner.quiet = true
111
121
 
112
122
  if block_given?
113
- yield(TestBuilder.new(runner))
123
+ return yield(TestBuilder.new(runner))
114
124
  else
115
125
  raise ArgumentError if args.empty?
116
126
  test = args.shift.to_sym
data/lib/tests/http.rb CHANGED
@@ -27,10 +27,12 @@ module Testotron
27
27
 
28
28
  begin
29
29
  response = http.request(request)
30
+ rescue Timeout::Error
31
+ raise TestFailed, "HTTP connection timed out (Timeout::Error)"
30
32
  rescue Errno::ETIMEDOUT
31
- raise TestFailed, "HTTP connection timed out"
33
+ raise TestFailed, "HTTP connection timed out (ETIMEDOUT)"
32
34
  rescue Errno::ECONNREFUSED
33
- raise TestFailed, "HTTP connection refused"
35
+ raise TestFailed, "HTTP connection refused (ECONNREFUSED)"
34
36
  rescue SocketError
35
37
  raise TestFailed, "HTTP connection failed (SocketError)"
36
38
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testotron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michal Pokorny
@@ -14,20 +13,18 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: mail
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
- description: ! "\t\tTestotron can automatically test basic functions of common servers,
27
+ description: "\t\tTestotron can automatically test basic functions of common servers,
31
28
  so you\n\t\tcan get an alert when some piece of your configuration stops working.\n"
32
29
  email: pok@rny.cz
33
30
  executables: []
@@ -40,26 +37,25 @@ files:
40
37
  - lib/tests/http.rb
41
38
  homepage: http://github.com/MichalPokorny/testotron
42
39
  licenses: []
40
+ metadata: {}
43
41
  post_install_message:
44
42
  rdoc_options: []
45
43
  require_paths:
46
44
  - lib
47
45
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
46
  requirements:
50
- - - ! '>='
47
+ - - '>='
51
48
  - !ruby/object:Gem::Version
52
49
  version: '0'
53
50
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
51
  requirements:
56
- - - ! '>='
52
+ - - '>='
57
53
  - !ruby/object:Gem::Version
58
54
  version: '0'
59
55
  requirements: []
60
56
  rubyforge_project:
61
- rubygems_version: 1.8.23
57
+ rubygems_version: 2.0.0
62
58
  signing_key:
63
- specification_version: 3
59
+ specification_version: 4
64
60
  summary: Simple server testing
65
61
  test_files: []