hq-log-monitor-client 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,6 +51,7 @@ Feature: Log monitor client provides context lines correctly
51
51
  }
52
52
  }
53
53
  """
54
+ And the script should return 0
54
55
 
55
56
  Scenario: Start of large file
56
57
 
@@ -83,6 +84,7 @@ Feature: Log monitor client provides context lines correctly
83
84
  }
84
85
  }
85
86
  """
87
+ And the script should return 0
86
88
 
87
89
  Scenario: End of large file
88
90
 
@@ -115,6 +117,7 @@ Feature: Log monitor client provides context lines correctly
115
117
  }
116
118
  }
117
119
  """
120
+ And the script should return 0
118
121
 
119
122
  Scenario: Middle of short file
120
123
 
@@ -144,3 +147,4 @@ Feature: Log monitor client provides context lines correctly
144
147
  }
145
148
  }
146
149
  """
150
+ And the script should return 0
@@ -56,6 +56,7 @@ Feature: Log monitor client does detects rotated log files
56
56
  },
57
57
  }
58
58
  """
59
+ And the script should return 0
59
60
 
60
61
  Scenario: Log file not rotated
61
62
 
@@ -84,3 +85,4 @@ Feature: Log monitor client does detects rotated log files
84
85
  },
85
86
  }
86
87
  """
88
+ And the script should return 0
@@ -20,43 +20,44 @@ Feature: Log monitor client correctly reports matching lines
20
20
  Scenario: Ignore lines which don't match any pattern
21
21
 
22
22
  Given a file "logfile.log":
23
- """
24
- NOTICE Not an error
25
- """
23
+ """
24
+ NOTICE Not an error
25
+ """
26
26
 
27
- When I run log-monitor-client with config "default.config"
27
+ When I run log-monitor-client with config "default.config"
28
28
 
29
- Then no events should be submitted
29
+ Then no events should be submitted
30
+ And the script should return 0
30
31
 
31
32
  Scenario: Produce events for lines which match a pattern
32
33
 
33
34
  Given a file "logfile.log":
34
- """
35
- WARNING This is a warning
36
- """
35
+ """
36
+ WARNING This is a warning
37
+ """
37
38
 
38
- When I run log-monitor-client with config "default.config"
39
+ When I run log-monitor-client with config "default.config"
39
40
 
40
- Then the following events should be submitted:
41
- """
42
- {
43
- type: warning,
44
- source: { class: class, host: host, service: service },
45
- location: { file: logfile.log, line: 0 },
46
- lines: {
47
- before: [],
48
- matching: WARNING This is a warning,
49
- after: [],
50
- },
51
- }
52
- """
41
+ Then the following events should be submitted:
42
+ """
43
+ {
44
+ type: warning,
45
+ source: { class: class, host: host, service: service },
46
+ location: { file: logfile.log, line: 0 },
47
+ lines: {
48
+ before: [],
49
+ matching: WARNING This is a warning,
50
+ after: [],
51
+ },
52
+ }
53
+ """
53
54
 
54
55
  Scenario: Only produce an event for the first matched pattern
55
56
 
56
57
  Given a file "logfile.log":
57
- """
58
- CRITICAL WARNING This is a confused log entry
59
- """
58
+ """
59
+ CRITICAL WARNING This is a confused log entry
60
+ """
60
61
 
61
62
  When I run log-monitor-client with config "default.config"
62
63
 
@@ -73,3 +74,4 @@ Feature: Log monitor client correctly reports matching lines
73
74
  },
74
75
  }
75
76
  """
77
+ And the script should return 0
@@ -19,8 +19,11 @@ Feature: Log monitor client does skips files which don't appear to have changed
19
19
  """
20
20
 
21
21
  Scenario: Ignore lines which don't match any pattern
22
+
22
23
  When I run log-monitor-client with config "default.config"
24
+
23
25
  Then no events should be submitted
26
+ And the script should return 0
24
27
 
25
28
  Scenario: Timestamp changed, size unchanged
26
29
 
@@ -49,6 +52,7 @@ Feature: Log monitor client does skips files which don't appear to have changed
49
52
  },
50
53
  }
51
54
  """
55
+ And the script should return 0
52
56
 
53
57
  Scenario: Size changed, timestamp unchanged
54
58
 
@@ -77,6 +81,7 @@ Feature: Log monitor client does skips files which don't appear to have changed
77
81
  },
78
82
  }
79
83
  """
84
+ And the script should return 0
80
85
 
81
86
  Scenario: Size and timestamp unchanged
82
87
 
@@ -93,3 +98,5 @@ Feature: Log monitor client does skips files which don't appear to have changed
93
98
  When I run log-monitor-client with config "default.config"
94
99
 
95
100
  Then no events should be submitted
101
+ And the script should return 0
102
+
@@ -66,3 +66,12 @@ Then /^the following events should be submitted:$/ do
66
66
  events_expected = YAML.load "[#{events_str}]"
67
67
  $events_received.should == events_expected
68
68
  end
69
+
70
+ Then /^the script should return (\d+)$/ do
71
+ |expect_str|
72
+
73
+ expect = expect_str.to_i
74
+
75
+ @script.status.should == expect
76
+
77
+ end
@@ -14,11 +14,15 @@ class Script
14
14
  attr_accessor :stderr
15
15
 
16
16
  def main
17
+
17
18
  process_args
18
19
  read_config
19
20
  read_cache
20
21
  perform_checks
21
22
  write_cache
23
+
24
+ @status = 0
25
+
22
26
  end
23
27
 
24
28
  def process_args
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hq-log-monitor-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: