flapjack 1.1.0 → 1.2.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +12 -7
  5. data/CHANGELOG.md +12 -0
  6. data/Gemfile +6 -2
  7. data/Gemfile-ruby1.9 +29 -0
  8. data/Gemfile-ruby1.9.lock +251 -0
  9. data/README.md +2 -2
  10. data/Rakefile +1 -0
  11. data/etc/flapjack_config.yaml.example +2 -2
  12. data/features/steps/events_steps.rb +2 -2
  13. data/features/steps/flapjack-netsaint-parser_steps.rb +1 -1
  14. data/features/support/env.rb +1 -6
  15. data/lib/flapjack/cli/import.rb +2 -5
  16. data/lib/flapjack/cli/purge.rb +4 -4
  17. data/lib/flapjack/cli/receiver.rb +122 -54
  18. data/lib/flapjack/cli/server.rb +0 -5
  19. data/lib/flapjack/coordinator.rb +6 -0
  20. data/lib/flapjack/data/contact.rb +10 -62
  21. data/lib/flapjack/data/entity.rb +36 -52
  22. data/lib/flapjack/data/entity_check.rb +90 -21
  23. data/lib/flapjack/data/event.rb +4 -5
  24. data/lib/flapjack/data/notification.rb +8 -10
  25. data/lib/flapjack/data/notification_rule.rb +32 -35
  26. data/lib/flapjack/data/tagged.rb +48 -0
  27. data/lib/flapjack/gateways/jabber.rb +4 -5
  28. data/lib/flapjack/gateways/jsonapi/check_methods.rb +45 -7
  29. data/lib/flapjack/gateways/jsonapi/check_presenter.rb +1 -1
  30. data/lib/flapjack/gateways/jsonapi/contact_methods.rb +8 -2
  31. data/lib/flapjack/gateways/jsonapi/entity_methods.rb +26 -8
  32. data/lib/flapjack/gateways/jsonapi/medium_methods.rb +13 -9
  33. data/lib/flapjack/gateways/jsonapi/metrics_methods.rb +2 -2
  34. data/lib/flapjack/gateways/jsonapi/notification_rule_methods.rb +1 -1
  35. data/lib/flapjack/gateways/jsonapi/pagerduty_credential_methods.rb +24 -17
  36. data/lib/flapjack/gateways/jsonapi/rack/json_params_parser.rb +1 -1
  37. data/lib/flapjack/gateways/jsonapi/report_methods.rb +4 -4
  38. data/lib/flapjack/gateways/jsonapi.rb +52 -31
  39. data/lib/flapjack/gateways/oobetet.rb +2 -3
  40. data/lib/flapjack/gateways/pagerduty.rb +9 -8
  41. data/lib/flapjack/gateways/web/public/js/backbone.jsonapi.js +19 -0
  42. data/lib/flapjack/gateways/web/public/js/flapjack.js +6 -2
  43. data/lib/flapjack/gateways/web/public/js/modules/contact.js +9 -14
  44. data/lib/flapjack/gateways/web/public/js/modules/medium.js +1 -0
  45. data/lib/flapjack/gateways/web/public/js/self_stats.js +1 -1
  46. data/lib/flapjack/gateways/web/views/edit_contacts.html.erb +3 -3
  47. data/lib/flapjack/gateways/web.rb +8 -7
  48. data/lib/flapjack/notifier.rb +2 -4
  49. data/lib/flapjack/processor.rb +2 -2
  50. data/lib/flapjack/version.rb +1 -1
  51. data/lib/flapjack.rb +10 -0
  52. data/spec/lib/flapjack/coordinator_spec.rb +18 -0
  53. data/spec/lib/flapjack/data/contact_spec.rb +4 -12
  54. data/spec/lib/flapjack/data/entity_check_spec.rb +56 -3
  55. data/spec/lib/flapjack/data/entity_spec.rb +79 -67
  56. data/spec/lib/flapjack/data/event_spec.rb +78 -78
  57. data/spec/lib/flapjack/data/notification_rule_spec.rb +4 -2
  58. data/spec/lib/flapjack/gateways/jsonapi/check_methods_spec.rb +94 -11
  59. data/spec/lib/flapjack/gateways/jsonapi/entity_methods_spec.rb +84 -0
  60. data/spec/lib/flapjack/gateways/pagerduty_spec.rb +5 -3
  61. data/spec/lib/flapjack/gateways/web_spec.rb +3 -3
  62. data/spec/service_consumers/pact_helper.rb +74 -0
  63. data/spec/service_consumers/pacts/flapjack-diner_v1.0.json +4522 -0
  64. data/spec/service_consumers/provider_states_for_flapjack-diner.rb +356 -0
  65. data/spec/spec_helper.rb +0 -8
  66. data/spec/support/jsonapi_helper.rb +1 -1
  67. data/tasks/benchmarks.rake +6 -3
  68. data/tasks/profile.rake +1 -1
  69. data/tmp/acknowledge.rb +0 -3
  70. data/tmp/create_event_ok.rb +0 -3
  71. data/tmp/create_event_unknown.rb +0 -3
  72. data/tmp/create_events_failure.rb +0 -3
  73. data/tmp/create_events_ok.rb +0 -3
  74. data/tmp/create_events_ok_fail_ack_ok.rb +0 -3
  75. data/tmp/create_events_ok_failure.rb +2 -5
  76. data/tmp/create_events_ok_failure_ack.rb +0 -3
  77. data/tmp/test_json_post.rb +4 -3
  78. data/tmp/test_notification_rules_api.rb +2 -3
  79. metadata +13 -8
  80. data/lib/flapjack/data/tag.rb +0 -61
  81. data/lib/flapjack/data/tag_set.rb +0 -16
  82. data/spec/lib/flapjack/data/tag_spec.rb +0 -36
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'set'
4
- require 'redis'
5
-
6
- module Flapjack
7
- module Data
8
-
9
- class Tag < ::Set
10
-
11
- attr_accessor :name
12
-
13
- def initialize(opts = {})
14
- raise "Redis connection not set" unless @redis = opts[:redis]
15
-
16
- @name = opts[:name]
17
- preset = @redis.smembers(@name)
18
- enum = opts[:create] || []
19
- @redis.sadd(@name, enum) unless enum.empty?
20
- super(enum | preset)
21
- end
22
-
23
- def self.find(name, opts)
24
- self.new(:name => name,
25
- :redis => opts[:redis])
26
- end
27
-
28
- def self.find_intersection(tags, opts)
29
- @redis = opts[:redis]
30
- @redis.sinter(tags)
31
- end
32
-
33
- def self.create(name, enum = [], opts)
34
- self.new(:name => name,
35
- :create => enum,
36
- :redis => opts[:redis])
37
- end
38
-
39
- def add(o)
40
- @redis.sadd(@name, o) unless o.empty?
41
- super(o)
42
- end
43
-
44
- def delete(o)
45
- @redis.srem(@name, o)
46
- super(o)
47
- end
48
-
49
- def merge(o)
50
- @redis.sadd(@name, o) unless o.empty?
51
- super(o)
52
- end
53
-
54
- def to_json(*a)
55
- self.to_a.to_json(*a)
56
- end
57
-
58
- end
59
- end
60
- end
61
-
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'set'
4
-
5
- module Flapjack
6
- module Data
7
- class TagSet < ::Set
8
-
9
- def to_json(*a)
10
- self.to_a.to_json(*a)
11
- end
12
-
13
- end
14
- end
15
- end
16
-
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
- require 'flapjack/data/tag'
3
-
4
- describe Flapjack::Data::Tag, :redis => true do
5
-
6
- it "adds references to tags" do
7
- tags = Flapjack::Data::Tag.create('special', ['apple', 'button', 'carbon'], :redis => @redis)
8
-
9
- expect(tags).to include('carbon')
10
- expect(tags).not_to include('chocolate')
11
-
12
- tags.add('chocolate')
13
- expect(tags).to include('chocolate')
14
- end
15
-
16
- it "deletes references from tags" do
17
- tags = Flapjack::Data::Tag.create('special', ['apple', 'button', 'carbon'], :redis => @redis)
18
-
19
- expect(tags).to include('apple')
20
- expect(tags).to include('button')
21
-
22
- tags.delete('button')
23
- expect(tags).to include('apple')
24
- expect(tags).not_to include('button')
25
- end
26
-
27
- it "lists references contained in a tag" do
28
- t1 = Flapjack::Data::Tag.create('special', ['apple', 'button', 'carbon'], :redis => @redis)
29
-
30
- t2 = Flapjack::Data::Tag.find('special', :redis => @redis)
31
- expect(t2).to include('apple')
32
- expect(t2).to include('carbon')
33
- expect(t2).not_to include('chocolate')
34
- end
35
-
36
- end