auger 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/cfg/examples/elasticsearch.rb +103 -45
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.2
1
+ 1.4.3
@@ -1,35 +1,97 @@
1
1
  require 'json'
2
2
 
3
- project "Elasticsearch" do
3
+ project "Elasticsearch - Production" do
4
4
  server "localhost"
5
-
5
+
6
6
  http 9200 do
7
- get "/_cluster/health" do
7
+ timeout 3
8
8
 
9
- # this runs after request returns, but before tests
10
- # use it to munge response body from json string into a hash
9
+ get "/" do
11
10
  before_tests do |r|
12
- if r['Content-Type'].respond_to?(:match) and r['Content-Type'].match /application\/json/
13
- begin
14
- r.body = JSON.parse(r.body)
15
- rescue JSON::ParserError
16
- puts "error parsing JSON in response body"
17
- end
11
+ r.body = JSON.parse(r.body)
12
+ r
13
+ end
14
+
15
+ test "version" do |r|
16
+ status = r.body["version"]["number"]
17
+ end
18
+
19
+ test "snapshot build?" do |r|
20
+ build = r.body["version"]["snapshot_build"]
21
+ Result build.to_s, build == false
22
+ end
23
+
24
+ end
25
+
26
+ get "/_settings" do
27
+ before_tests do |r|
28
+ r.body = JSON.parse(r.body)
29
+ r
30
+ end
31
+
32
+ test "translog flush disabled?" do |r|
33
+ color = r.body["brew_production-0"]["settings"]["index.translog.disable_flush"]
34
+ status = case color
35
+ when 'false' then :ok
36
+ when 'true' then :warn
37
+ else :ok
18
38
  end
39
+ Result color, Status(status)
19
40
  end
41
+ end
20
42
 
21
- # simple as it gets... did we get 200 back?
22
- test "Status 200" do |r|
23
- r.code == '200'
43
+ get "/_cluster/settings" do
44
+ before_tests do |r|
45
+ r.body = JSON.parse(r.body)
46
+ r
47
+ end
48
+
49
+ test "replica allocation disabled?" do |r|
50
+ color = r.body["transient"]["cluster.routing.allocation.disable_replica_allocation"]
51
+ status = case color
52
+ when 'false' then :ok
53
+ when 'true' then :warn
54
+ else :ok
55
+ end
56
+ Result color, Status(status)
57
+ end
58
+ test "shard allocation disabled?" do |r|
59
+ color = r.body["transient"]["cluster.routing.allocation.disable_allocation"]
60
+ status = case color
61
+ when 'false' then :ok
62
+ when 'true' then :warn
63
+ else :ok
64
+ end
65
+ Result color, Status(status)
66
+ end
67
+
68
+ end
69
+
70
+ get "/_cluster/health" do
71
+ ## this runs after request returns, but before tests
72
+ ## use it to munge response body from json string into a hash
73
+ before_tests do |r|
74
+ r.body = JSON.parse(r.body)
75
+ r
76
+ end
77
+
78
+ test "HTTP Status" do |r|
79
+ Result r.code, r.code == '200'
80
+ end
81
+
82
+ test "cluster status" do |r|
83
+ color = r.body["status"]
84
+ status = case color
85
+ when 'green' then :ok
86
+ when 'yellow' then :warn
87
+ else :error
88
+ end
89
+ Result color, Status(status)
24
90
  end
25
91
 
26
- # an array of stats we want to collect
27
92
  stats = %w[
28
93
  cluster_name
29
- status
30
- timed_out
31
94
  number_of_nodes
32
- number_of_data_nodes
33
95
  active_primary_shards
34
96
  active_shards
35
97
  relocating_shards
@@ -37,39 +99,35 @@ project "Elasticsearch" do
37
99
  unassigned_shards
38
100
  ]
39
101
 
40
- # loop through each stat
41
- # if the body is a hash, return the value
42
102
  stats.each do |stat|
43
103
  test "#{stat}" do |r|
44
- if r.body.is_a? Hash
45
- r.body[stat]
46
- else
47
- false
48
- end
104
+ r.body[stat]
49
105
  end
50
106
  end
51
107
 
52
- # I've discovered that a typical fail case with elasticsearch is
53
- # that on occassion, nodes will come up and not join the cluster
54
- # This is an easy way to see if the number of nodes that the host
55
- # actually sees (actual_data_nodes) matches what we're
56
- # expecting (expected_data_nodes).
57
- # TODO: dynamically update expected_data_nodes based on defined hosts:
58
- test "Expected vs Actual Nodes" do |r|
59
- if r.body.is_a? Hash
60
- expected_data_nodes = 8
61
- actual_data_nodes = r.body['number_of_data_nodes']
62
-
63
- if expected_data_nodes == actual_data_nodes
64
- true
65
- else
66
- false
67
- end
68
- else
69
- false
70
- end
108
+ test "number of data nodes" do |r|
109
+ nodes = r.body['number_of_data_nodes']
110
+ Result nodes, nodes == 4
71
111
  end
112
+
72
113
  end
114
+
115
+ get "/_nodes/_local/stats?all" do
116
+ before_tests do |r|
117
+ JSON.parse(r.body)
118
+ end
119
+
120
+ test "open file descriptors" do |r|
121
+ r['nodes'].first[1]['process']['open_file_descriptors']
122
+ end
123
+
124
+ test "heap used" do |r|
125
+ used, committed = r["nodes"].first[1]['jvm']['mem'].values_at('heap_used','heap_committed')
126
+ "#{used} (of #{committed})"
127
+ end
128
+
129
+ end
130
+
73
131
  end
74
- end
75
132
 
133
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-15 00:00:00.000000000 Z
13
+ date: 2012-11-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json