easymon 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of easymon might be problematic. Click here for more details.

@@ -1 +1 @@
1
- o: ActiveSupport::Cache::Entry: @valuei:@created_atf1402603877.236094:@expires_in0
1
+ o: ActiveSupport::Cache::Entry: @valuei:@created_atf1403613313.401854:@expires_in0
@@ -6,29 +6,29 @@ class ChecklistTest < ActiveSupport::TestCase
6
6
  Easymon::Repository.add("redis", Easymon::RedisCheck.new(YAML.load_file(Rails.root.join("config/redis.yml"))[Rails.env].symbolize_keys))
7
7
  Easymon::Repository.add("memcached", Easymon::MemcachedCheck.new(Rails.cache))
8
8
  end
9
-
9
+
10
10
  test "it knows the number of checks in the Repository" do
11
11
  checklist = Easymon::Repository.all
12
-
12
+
13
13
  assert_equal 3, checklist.size
14
14
  end
15
-
15
+
16
16
  test "it will run each check" do
17
17
  checklist = Easymon::Repository.all
18
-
18
+
19
19
  checklist.check
20
20
  assert_equal checklist.size, checklist.results.size
21
21
  end
22
-
22
+
23
23
  test "#to_s returns a valid representation of the checklist" do
24
24
  checklist = Easymon::Repository.all
25
-
25
+
26
26
  checklist.check
27
27
  checklist.items.keys.each do |name|
28
28
  assert checklist.to_s.include?("#{name}: Up"), "#to_s doesn't include '#{name}: Up'"
29
29
  end
30
30
  end
31
-
31
+
32
32
  test "#timing is a sum of all check results" do
33
33
  checklist = Easymon::Repository.all
34
34
  # Fake some results
@@ -37,40 +37,40 @@ class ChecklistTest < ActiveSupport::TestCase
37
37
  hash[name] = Easymon::Result.new([name, "dummy message"], timing)
38
38
  hash
39
39
  end
40
-
40
+
41
41
  assert_in_delta 3.6, checklist.timing, 0.01
42
42
  end
43
-
43
+
44
44
  test "#response_status returns :ok when all checks pass" do
45
45
  checklist = Easymon::Repository.all
46
-
46
+
47
47
  checklist.check
48
48
  assert_equal :ok, checklist.response_status
49
49
  end
50
-
50
+
51
51
  test "#response_status returns :service_unavailable when a check fails" do
52
52
  Redis.any_instance.stubs(:ping).raises("boom")
53
53
  checklist = Easymon::Repository.all
54
-
54
+
55
55
  checklist.check
56
56
  assert_equal :service_unavailable, checklist.response_status
57
57
  end
58
-
58
+
59
59
  test "#success? returns false when results is empty" do
60
60
  checklist = Easymon::Repository.all
61
-
61
+
62
62
  assert_equal false, checklist.success?
63
63
  end
64
-
64
+
65
65
  test "can look up checks by name" do
66
66
  checklist = Easymon::Repository.all
67
-
67
+
68
68
  assert checklist.include?("database")
69
69
  end
70
-
70
+
71
71
  test "cat fetch a check by name" do
72
72
  checklist = Easymon::Repository.all
73
-
74
- assert checklist.fetch("database").instance_of? Easymon::ActiveRecordCheck
73
+
74
+ assert checklist.fetch("database")[:check].instance_of? Easymon::ActiveRecordCheck
75
75
  end
76
76
  end
@@ -1,58 +1,52 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RepositoryTest < ActiveSupport::TestCase
4
-
4
+
5
5
  test "we can add a check to the repository" do
6
6
  Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base))
7
7
  check = Easymon::Repository.fetch("database")
8
-
8
+
9
9
  assert_equal 1, Easymon::Repository.repository.size, Easymon::Repository.repository.inspect
10
- assert check.instance_of? Easymon::ActiveRecordCheck
10
+ assert check[:check].instance_of? Easymon::ActiveRecordCheck
11
11
  end
12
-
12
+
13
13
  test "we can remove a check from the repository" do
14
14
  Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base))
15
15
  assert_equal 1, Easymon::Repository.repository.size
16
-
16
+
17
17
  Easymon::Repository.remove("database")
18
18
  exception = assert_raises Easymon::NoSuchCheck do
19
19
  Easymon::Repository.fetch("database")
20
20
  end
21
-
21
+
22
22
  assert_equal "No check named 'database'", exception.message
23
23
  assert_equal 0, Easymon::Repository.repository.size
24
24
  end
25
-
25
+
26
26
  test "returns a checklist when asked" do
27
27
  Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base))
28
28
  checklist = Easymon::Repository.all
29
-
29
+
30
30
  assert checklist.instance_of? Easymon::Checklist
31
31
  end
32
-
32
+
33
33
  test "adds checks marked critical to the critical checklist" do
34
- Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base), true)
35
-
34
+ Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base), :critical)
35
+
36
36
  assert Easymon::Repository.critical.include?("database")
37
37
  end
38
-
39
- test "adds a check to the repository for the critical checklist" do
40
- Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base), true)
41
-
42
- assert Easymon::Repository.repository.include?("critical")
43
- end
44
-
38
+
45
39
  test "fetches a check by name" do
46
40
  Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base))
47
41
  check = Easymon::Repository.fetch("database")
48
-
49
- assert check.instance_of? Easymon::ActiveRecordCheck
42
+
43
+ assert check[:check].instance_of? Easymon::ActiveRecordCheck
50
44
  end
51
-
45
+
52
46
  test "fetches a critical check by name" do
53
- Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base), true)
47
+ Easymon::Repository.add("database", Easymon::ActiveRecordCheck.new(ActiveRecord::Base), :critical)
54
48
  check = Easymon::Repository.fetch("database")
55
-
56
- assert check.instance_of? Easymon::ActiveRecordCheck
49
+
50
+ assert check[:check].instance_of? Easymon::ActiveRecordCheck
57
51
  end
58
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easymon
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-12 00:00:00.000000000 Z
11
+ date: 2014-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client