dalli-elasticache 0.1.1 → 1.0.1
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.
- checksums.yaml +5 -13
- data/README.md +36 -21
- data/Rakefile +7 -4
- 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 +42 -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 +106 -23
- 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 +115 -29
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,106 +1,192 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dalli-elasticache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Suggs
|
8
|
-
|
8
|
+
- Zach Millman
|
9
|
+
- Peter M. Goldstein
|
10
|
+
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
12
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'
|
13
29
|
- !ruby/object:Gem::Dependency
|
14
30
|
name: rake
|
15
31
|
requirement: !ruby/object:Gem::Requirement
|
16
32
|
requirements:
|
17
|
-
- -
|
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
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
18
76
|
- !ruby/object:Gem::Version
|
19
77
|
version: '0'
|
20
78
|
type: :development
|
21
79
|
prerelease: false
|
22
80
|
version_requirements: !ruby/object:Gem::Requirement
|
23
81
|
requirements:
|
24
|
-
- -
|
82
|
+
- - ">="
|
25
83
|
- !ruby/object:Gem::Version
|
26
84
|
version: '0'
|
27
85
|
- !ruby/object:Gem::Dependency
|
28
|
-
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
|
29
101
|
requirement: !ruby/object:Gem::Requirement
|
30
102
|
requirements:
|
31
|
-
- -
|
103
|
+
- - ">="
|
32
104
|
- !ruby/object:Gem::Version
|
33
105
|
version: '0'
|
34
106
|
type: :development
|
35
107
|
prerelease: false
|
36
108
|
version_requirements: !ruby/object:Gem::Requirement
|
37
109
|
requirements:
|
38
|
-
- -
|
110
|
+
- - ">="
|
39
111
|
- !ruby/object:Gem::Version
|
40
112
|
version: '0'
|
41
113
|
- !ruby/object:Gem::Dependency
|
42
114
|
name: dalli
|
43
115
|
requirement: !ruby/object:Gem::Requirement
|
44
116
|
requirements:
|
45
|
-
- -
|
117
|
+
- - ">="
|
46
118
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
119
|
+
version: 2.0.0
|
48
120
|
type: :runtime
|
49
121
|
prerelease: false
|
50
122
|
version_requirements: !ruby/object:Gem::Requirement
|
51
123
|
requirements:
|
52
|
-
- -
|
124
|
+
- - ">="
|
53
125
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
description:
|
56
|
-
|
57
|
-
|
58
|
-
|
126
|
+
version: 2.0.0
|
127
|
+
description: |2
|
128
|
+
This gem provides an interface for fetching cluster information from an AWS
|
129
|
+
ElastiCache AutoDiscovery server and configuring a Dalli client to connect
|
130
|
+
to all nodes in the cache cluster.
|
131
|
+
email:
|
132
|
+
- aaron@ktheory.com
|
133
|
+
- zach@magoosh.com
|
134
|
+
- peter.m.goldstein@gmail.com
|
59
135
|
executables: []
|
60
136
|
extensions: []
|
61
137
|
extra_rdoc_files: []
|
62
138
|
files:
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- lib/dalli-elasticache.rb
|
142
|
+
- lib/dalli/elasticache.rb
|
143
|
+
- lib/dalli/elasticache/auto_discovery/base_command.rb
|
144
|
+
- lib/dalli/elasticache/auto_discovery/config_command.rb
|
63
145
|
- lib/dalli/elasticache/auto_discovery/config_response.rb
|
64
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
|
65
149
|
- lib/dalli/elasticache/auto_discovery/stats_response.rb
|
66
150
|
- lib/dalli/elasticache/version.rb
|
67
|
-
-
|
68
|
-
- lib/dalli-elasticache.rb
|
69
|
-
- README.md
|
70
|
-
- Rakefile
|
151
|
+
- spec/config_command_spec.rb
|
71
152
|
- spec/config_response_spec.rb
|
72
153
|
- spec/elasticache_spec.rb
|
73
154
|
- spec/endpoint_spec.rb
|
155
|
+
- spec/node_spec.rb
|
74
156
|
- spec/spec_helper.rb
|
157
|
+
- spec/stats_command_spec.rb
|
75
158
|
- spec/stats_response_spec.rb
|
76
159
|
homepage: http://github.com/ktheory/dalli-elasticache
|
77
160
|
licenses:
|
78
161
|
- MIT
|
79
|
-
metadata:
|
80
|
-
|
162
|
+
metadata:
|
163
|
+
rubygems_mfa_required: 'true'
|
164
|
+
post_install_message:
|
81
165
|
rdoc_options:
|
82
|
-
- --charset=UTF-8
|
166
|
+
- "--charset=UTF-8"
|
83
167
|
require_paths:
|
84
168
|
- lib
|
85
169
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
170
|
requirements:
|
87
|
-
- -
|
171
|
+
- - ">="
|
88
172
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
173
|
+
version: 2.6.0
|
90
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
175
|
requirements:
|
92
|
-
- -
|
176
|
+
- - ">="
|
93
177
|
- !ruby/object:Gem::Version
|
94
178
|
version: 1.3.5
|
95
179
|
requirements: []
|
96
|
-
|
97
|
-
|
98
|
-
signing_key:
|
180
|
+
rubygems_version: 3.3.5
|
181
|
+
signing_key:
|
99
182
|
specification_version: 4
|
100
183
|
summary: Configure Dalli clients with ElastiCache's AutoDiscovery
|
101
184
|
test_files:
|
185
|
+
- spec/config_command_spec.rb
|
102
186
|
- spec/config_response_spec.rb
|
103
187
|
- spec/elasticache_spec.rb
|
104
188
|
- spec/endpoint_spec.rb
|
189
|
+
- spec/node_spec.rb
|
105
190
|
- spec/spec_helper.rb
|
191
|
+
- spec/stats_command_spec.rb
|
106
192
|
- spec/stats_response_spec.rb
|