dalli-elasticache 0.2.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +31 -16
- data/Rakefile +7 -5
- data/lib/dalli/elasticache/auto_discovery/base_command.rb +42 -0
- data/lib/dalli/elasticache/auto_discovery/config_command.rb +45 -0
- data/lib/dalli/elasticache/auto_discovery/config_response.rb +15 -18
- data/lib/dalli/elasticache/auto_discovery/endpoint.rb +28 -59
- data/lib/dalli/elasticache/auto_discovery/node.rb +39 -0
- data/lib/dalli/elasticache/auto_discovery/stats_command.rb +23 -0
- data/lib/dalli/elasticache/auto_discovery/stats_response.rb +15 -12
- data/lib/dalli/elasticache/version.rb +3 -1
- data/lib/dalli/elasticache.rb +40 -14
- data/lib/dalli-elasticache.rb +3 -1
- data/spec/config_command_spec.rb +101 -0
- data/spec/config_response_spec.rb +15 -11
- data/spec/elasticache_spec.rb +93 -27
- data/spec/endpoint_spec.rb +77 -6
- data/spec/node_spec.rb +82 -0
- data/spec/spec_helper.rb +7 -10
- data/spec/stats_command_spec.rb +90 -0
- data/spec/stats_response_spec.rb +111 -8
- metadata +94 -12
data/spec/stats_response_spec.rb
CHANGED
@@ -1,14 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'spec_helper'
|
2
4
|
|
3
5
|
describe 'Dalli::Elasticache::AutoDiscovery::StatsResponse' do
|
4
|
-
let
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
let(:response) { Dalli::Elasticache::AutoDiscovery::StatsResponse.new(response_text) }
|
7
|
+
|
8
|
+
describe '#engine_version' do
|
9
|
+
context 'when the version number is a number' do
|
10
|
+
let(:engine_version) { ['1.4.14', '1.5.6', '1.6.10'].sample }
|
11
|
+
|
12
|
+
context 'when the response with the version stat only includes the version number' do
|
13
|
+
let(:response_text) do
|
14
|
+
"STAT pid 1\r\nSTAT uptime 68717\r\nSTAT time 1398885375\r\n"\
|
15
|
+
"STAT version #{engine_version}\r\n"\
|
16
|
+
"STAT libevent 1.4.13-stable\r\nSTAT pointer_size 64\r\nSTAT rusage_user 0.136008\r\n"\
|
17
|
+
"STAT rusage_system 0.424026\r\nSTAT curr_connections 5\r\nSTAT total_connections 1159\r\n"\
|
18
|
+
"STAT connection_structures 6\r\nSTAT reserved_fds 5\r\nSTAT cmd_get 0\r\n"\
|
19
|
+
"STAT cmd_set 0\r\nSTAT cmd_flush 0\r\nSTAT cmd_touch 0\r\nSTAT cmd_config_get 4582\r\n"\
|
20
|
+
"STAT cmd_config_set 2\r\nSTAT get_hits 0\r\nSTAT get_misses 0\r\nSTAT delete_misses 0\r\n"\
|
21
|
+
"STAT delete_hits 0\r\nSTAT incr_misses 0\r\nSTAT incr_hits 0\r\nSTAT decr_misses 0\r\n"\
|
22
|
+
"STAT decr_hits 0\r\nSTAT cas_misses 0\r\nSTAT cas_hits 0\r\nSTAT cas_badval 0\r\n"\
|
23
|
+
"STAT touch_hits 0\r\nSTAT touch_misses 0\r\nSTAT auth_cmds 0\r\nSTAT auth_errors 0\r\n"\
|
24
|
+
"STAT bytes_read 189356\r\nSTAT bytes_written 2906615\r\nSTAT limit_maxbytes 209715200\r\n"\
|
25
|
+
"STAT accepting_conns 1\r\nSTAT listen_disabled_num 0\r\nSTAT threads 1\r\n"\
|
26
|
+
"STAT conn_yields 0\r\nSTAT curr_config 1\r\nSTAT hash_power_level 16\r\n"\
|
27
|
+
"STAT hash_bytes 524288\r\nSTAT hash_is_expanding 0\r\nSTAT expired_unfetched 0\r\n"\
|
28
|
+
"STAT evicted_unfetched 0\r\nSTAT bytes 0\r\nSTAT curr_items 0\r\nSTAT total_items 0\r\n"\
|
29
|
+
"STAT evictions 0\r\nSTAT reclaimed 0\r\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'parses out the engine version' do
|
33
|
+
expect(response.engine_version).to eq engine_version
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when the response with the version stat includes the version number and trailing text' do
|
38
|
+
let(:response_text) do
|
39
|
+
"STAT pid 1\r\nSTAT uptime 68717\r\nSTAT time 1398885375\r\n"\
|
40
|
+
"STAT version #{engine_version} #{SecureRandom.hex(5)}\r\n"\
|
41
|
+
"STAT libevent 1.4.13-stable\r\nSTAT pointer_size 64\r\nSTAT rusage_user 0.136008\r\n"\
|
42
|
+
"STAT rusage_system 0.424026\r\nSTAT curr_connections 5\r\nSTAT total_connections 1159\r\n"\
|
43
|
+
"STAT connection_structures 6\r\nSTAT reserved_fds 5\r\nSTAT cmd_get 0\r\n"\
|
44
|
+
"STAT cmd_set 0\r\nSTAT cmd_flush 0\r\nSTAT cmd_touch 0\r\nSTAT cmd_config_get 4582\r\n"\
|
45
|
+
"STAT cmd_config_set 2\r\nSTAT get_hits 0\r\nSTAT get_misses 0\r\nSTAT delete_misses 0\r\n"\
|
46
|
+
"STAT delete_hits 0\r\nSTAT incr_misses 0\r\nSTAT incr_hits 0\r\nSTAT decr_misses 0\r\n"\
|
47
|
+
"STAT decr_hits 0\r\nSTAT cas_misses 0\r\nSTAT cas_hits 0\r\nSTAT cas_badval 0\r\n"\
|
48
|
+
"STAT touch_hits 0\r\nSTAT touch_misses 0\r\nSTAT auth_cmds 0\r\nSTAT auth_errors 0\r\n"\
|
49
|
+
"STAT bytes_read 189356\r\nSTAT bytes_written 2906615\r\nSTAT limit_maxbytes 209715200\r\n"\
|
50
|
+
"STAT accepting_conns 1\r\nSTAT listen_disabled_num 0\r\nSTAT threads 1\r\n"\
|
51
|
+
"STAT conn_yields 0\r\nSTAT curr_config 1\r\nSTAT hash_power_level 16\r\n"\
|
52
|
+
"STAT hash_bytes 524288\r\nSTAT hash_is_expanding 0\r\nSTAT expired_unfetched 0\r\n"\
|
53
|
+
"STAT evicted_unfetched 0\r\nSTAT bytes 0\r\nSTAT curr_items 0\r\nSTAT total_items 0\r\n"\
|
54
|
+
"STAT evictions 0\r\nSTAT reclaimed 0\r\n"
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'parses out the engine version' do
|
58
|
+
expect(response.engine_version).to eq engine_version
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "when the version number is the string 'unknown'" do
|
64
|
+
let(:engine_version) { 'UNKNOWN' }
|
65
|
+
|
66
|
+
context 'when the response with the version stat only includes the version number' do
|
67
|
+
let(:response_text) do
|
68
|
+
"STAT pid 1\r\nSTAT uptime 68717\r\nSTAT time 1398885375\r\n"\
|
69
|
+
"STAT version #{engine_version}\r\n"\
|
70
|
+
"STAT libevent 1.4.13-stable\r\nSTAT pointer_size 64\r\nSTAT rusage_user 0.136008\r\n"\
|
71
|
+
"STAT rusage_system 0.424026\r\nSTAT curr_connections 5\r\nSTAT total_connections 1159\r\n"\
|
72
|
+
"STAT connection_structures 6\r\nSTAT reserved_fds 5\r\nSTAT cmd_get 0\r\n"\
|
73
|
+
"STAT cmd_set 0\r\nSTAT cmd_flush 0\r\nSTAT cmd_touch 0\r\nSTAT cmd_config_get 4582\r\n"\
|
74
|
+
"STAT cmd_config_set 2\r\nSTAT get_hits 0\r\nSTAT get_misses 0\r\nSTAT delete_misses 0\r\n"\
|
75
|
+
"STAT delete_hits 0\r\nSTAT incr_misses 0\r\nSTAT incr_hits 0\r\nSTAT decr_misses 0\r\n"\
|
76
|
+
"STAT decr_hits 0\r\nSTAT cas_misses 0\r\nSTAT cas_hits 0\r\nSTAT cas_badval 0\r\n"\
|
77
|
+
"STAT touch_hits 0\r\nSTAT touch_misses 0\r\nSTAT auth_cmds 0\r\nSTAT auth_errors 0\r\n"\
|
78
|
+
"STAT bytes_read 189356\r\nSTAT bytes_written 2906615\r\nSTAT limit_maxbytes 209715200\r\n"\
|
79
|
+
"STAT accepting_conns 1\r\nSTAT listen_disabled_num 0\r\nSTAT threads 1\r\n"\
|
80
|
+
"STAT conn_yields 0\r\nSTAT curr_config 1\r\nSTAT hash_power_level 16\r\n"\
|
81
|
+
"STAT hash_bytes 524288\r\nSTAT hash_is_expanding 0\r\nSTAT expired_unfetched 0\r\n"\
|
82
|
+
"STAT evicted_unfetched 0\r\nSTAT bytes 0\r\nSTAT curr_items 0\r\nSTAT total_items 0\r\n"\
|
83
|
+
"STAT evictions 0\r\nSTAT reclaimed 0\r\n"
|
84
|
+
end
|
85
|
+
|
86
|
+
it "parses out the engine version as 'UNKNOWN'" do
|
87
|
+
expect(response.engine_version).to eq engine_version
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'when the response with the version stat includes the version number and trailing text' do
|
92
|
+
let(:response_text) do
|
93
|
+
"STAT pid 1\r\nSTAT uptime 68717\r\nSTAT time 1398885375\r\n"\
|
94
|
+
"STAT version #{engine_version} #{SecureRandom.hex(5)}\r\n"\
|
95
|
+
"STAT libevent 1.4.13-stable\r\nSTAT pointer_size 64\r\nSTAT rusage_user 0.136008\r\n"\
|
96
|
+
"STAT rusage_system 0.424026\r\nSTAT curr_connections 5\r\nSTAT total_connections 1159\r\n"\
|
97
|
+
"STAT connection_structures 6\r\nSTAT reserved_fds 5\r\nSTAT cmd_get 0\r\n"\
|
98
|
+
"STAT cmd_set 0\r\nSTAT cmd_flush 0\r\nSTAT cmd_touch 0\r\nSTAT cmd_config_get 4582\r\n"\
|
99
|
+
"STAT cmd_config_set 2\r\nSTAT get_hits 0\r\nSTAT get_misses 0\r\nSTAT delete_misses 0\r\n"\
|
100
|
+
"STAT delete_hits 0\r\nSTAT incr_misses 0\r\nSTAT incr_hits 0\r\nSTAT decr_misses 0\r\n"\
|
101
|
+
"STAT decr_hits 0\r\nSTAT cas_misses 0\r\nSTAT cas_hits 0\r\nSTAT cas_badval 0\r\n"\
|
102
|
+
"STAT touch_hits 0\r\nSTAT touch_misses 0\r\nSTAT auth_cmds 0\r\nSTAT auth_errors 0\r\n"\
|
103
|
+
"STAT bytes_read 189356\r\nSTAT bytes_written 2906615\r\nSTAT limit_maxbytes 209715200\r\n"\
|
104
|
+
"STAT accepting_conns 1\r\nSTAT listen_disabled_num 0\r\nSTAT threads 1\r\n"\
|
105
|
+
"STAT conn_yields 0\r\nSTAT curr_config 1\r\nSTAT hash_power_level 16\r\n"\
|
106
|
+
"STAT hash_bytes 524288\r\nSTAT hash_is_expanding 0\r\nSTAT expired_unfetched 0\r\n"\
|
107
|
+
"STAT evicted_unfetched 0\r\nSTAT bytes 0\r\nSTAT curr_items 0\r\nSTAT total_items 0\r\n"\
|
108
|
+
"STAT evictions 0\r\nSTAT reclaimed 0\r\n"
|
109
|
+
end
|
110
|
+
|
111
|
+
it "parses out the engine version as 'UNKNOWN'" do
|
112
|
+
expect(response.engine_version).to eq engine_version
|
113
|
+
end
|
114
|
+
end
|
12
115
|
end
|
13
116
|
end
|
14
117
|
end
|
metadata
CHANGED
@@ -1,18 +1,75 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dalli-elasticache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Suggs
|
8
8
|
- Zach Millman
|
9
|
-
|
9
|
+
- Peter M. Goldstein
|
10
|
+
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: faker
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.19'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '2.19'
|
14
29
|
- !ruby/object:Gem::Dependency
|
15
30
|
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '13.0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '13.0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.10'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.10'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rubocop
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rubocop-performance
|
16
73
|
requirement: !ruby/object:Gem::Requirement
|
17
74
|
requirements:
|
18
75
|
- - ">="
|
@@ -26,7 +83,21 @@ dependencies:
|
|
26
83
|
- !ruby/object:Gem::Version
|
27
84
|
version: '0'
|
28
85
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
86
|
+
name: rubocop-rake
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: rubocop-rspec
|
30
101
|
requirement: !ruby/object:Gem::Requirement
|
31
102
|
requirements:
|
32
103
|
- - ">="
|
@@ -45,14 +116,14 @@ dependencies:
|
|
45
116
|
requirements:
|
46
117
|
- - ">="
|
47
118
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
119
|
+
version: 2.0.0
|
49
120
|
type: :runtime
|
50
121
|
prerelease: false
|
51
122
|
version_requirements: !ruby/object:Gem::Requirement
|
52
123
|
requirements:
|
53
124
|
- - ">="
|
54
125
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
126
|
+
version: 2.0.0
|
56
127
|
description: |2
|
57
128
|
This gem provides an interface for fetching cluster information from an AWS
|
58
129
|
ElastiCache AutoDiscovery server and configuring a Dalli client to connect
|
@@ -60,6 +131,7 @@ description: |2
|
|
60
131
|
email:
|
61
132
|
- aaron@ktheory.com
|
62
133
|
- zach@magoosh.com
|
134
|
+
- peter.m.goldstein@gmail.com
|
63
135
|
executables: []
|
64
136
|
extensions: []
|
65
137
|
extra_rdoc_files: []
|
@@ -68,20 +140,28 @@ files:
|
|
68
140
|
- Rakefile
|
69
141
|
- lib/dalli-elasticache.rb
|
70
142
|
- lib/dalli/elasticache.rb
|
143
|
+
- lib/dalli/elasticache/auto_discovery/base_command.rb
|
144
|
+
- lib/dalli/elasticache/auto_discovery/config_command.rb
|
71
145
|
- lib/dalli/elasticache/auto_discovery/config_response.rb
|
72
146
|
- lib/dalli/elasticache/auto_discovery/endpoint.rb
|
147
|
+
- lib/dalli/elasticache/auto_discovery/node.rb
|
148
|
+
- lib/dalli/elasticache/auto_discovery/stats_command.rb
|
73
149
|
- lib/dalli/elasticache/auto_discovery/stats_response.rb
|
74
150
|
- lib/dalli/elasticache/version.rb
|
151
|
+
- spec/config_command_spec.rb
|
75
152
|
- spec/config_response_spec.rb
|
76
153
|
- spec/elasticache_spec.rb
|
77
154
|
- spec/endpoint_spec.rb
|
155
|
+
- spec/node_spec.rb
|
78
156
|
- spec/spec_helper.rb
|
157
|
+
- spec/stats_command_spec.rb
|
79
158
|
- spec/stats_response_spec.rb
|
80
159
|
homepage: http://github.com/ktheory/dalli-elasticache
|
81
160
|
licenses:
|
82
161
|
- MIT
|
83
|
-
metadata:
|
84
|
-
|
162
|
+
metadata:
|
163
|
+
rubygems_mfa_required: 'true'
|
164
|
+
post_install_message:
|
85
165
|
rdoc_options:
|
86
166
|
- "--charset=UTF-8"
|
87
167
|
require_paths:
|
@@ -90,21 +170,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
170
|
requirements:
|
91
171
|
- - ">="
|
92
172
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
173
|
+
version: 2.6.0
|
94
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
175
|
requirements:
|
96
176
|
- - ">="
|
97
177
|
- !ruby/object:Gem::Version
|
98
178
|
version: 1.3.5
|
99
179
|
requirements: []
|
100
|
-
|
101
|
-
|
102
|
-
signing_key:
|
180
|
+
rubygems_version: 3.3.5
|
181
|
+
signing_key:
|
103
182
|
specification_version: 4
|
104
183
|
summary: Configure Dalli clients with ElastiCache's AutoDiscovery
|
105
184
|
test_files:
|
185
|
+
- spec/config_command_spec.rb
|
106
186
|
- spec/config_response_spec.rb
|
107
187
|
- spec/elasticache_spec.rb
|
108
188
|
- spec/endpoint_spec.rb
|
189
|
+
- spec/node_spec.rb
|
109
190
|
- spec/spec_helper.rb
|
191
|
+
- spec/stats_command_spec.rb
|
110
192
|
- spec/stats_response_spec.rb
|