Skip to content

Commit fdc3806

Browse files
committed
Merge upstream main branch
2 parents 791ead7 + 3ccffdb commit fdc3806

File tree

11 files changed

+54
-11
lines changed

11 files changed

+54
-11
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, jruby-9.1, jruby-9.2, jruby-9.3, jruby-9.4]
19+
20+
steps:
21+
- name: Setup
22+
uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: ${{ matrix.ruby }}
25+
26+
- uses: actions/checkout@v2
27+
28+
- name: Install
29+
run: bundle install --without docs
30+
31+
- name: Test
32+
run: bundle exec rake spec

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ coverage
33
.yardoc
44
Gemfile.lock
55
.release
6+
.idea/

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Unreleased Changes
22
------------------
33

4+
2.1.0 (2023-06-02)
5+
------------------
6+
7+
* Feature - Improve User-Agent tracking and bump minimum DynamoDB version.
8+
49
2.0.1 (2020-11-16)
510
------------------
611

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ group :test do
1414
gem 'rspec'
1515
gem 'simplecov', require: false
1616
gem 'rack-test'
17+
18+
if RUBY_VERSION >= '3.0'
19+
gem 'rexml'
20+
end
1721
end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.1
1+
2.1.0

aws-sessionstore-dynamodb.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
1515
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
1616
spec.require_paths = ["lib"]
1717

18-
spec.add_dependency 'aws-sdk-dynamodb', '~> 1'
18+
spec.add_dependency 'aws-sdk-dynamodb', '~> 1', '>= 1.85.0'
1919
spec.add_dependency('actionpack', '>= 6.1')
2020
spec.add_dependency 'rack', '~> 3'
2121
spec.add_dependency 'rack-session', '>= 2.0.0'

lib/aws/session_store/dynamo_db/configuration.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ def to_hash
145145

146146
# @return [Hash] DDB client.
147147
def gen_dynamo_db_client
148-
client_opts = { user_agent_suffix: " aws-sessionstore/#{VERSION}" }
149-
client = Aws::DynamoDB::Client
150-
dynamo_db_client = @options[:dynamo_db_client] || client.new(client_opts)
148+
dynamo_db_client = @options[:dynamo_db_client] || Aws::DynamoDB::Client.new
149+
# this used to be aws-sessionstore/version on user_agent_suffix
150+
dynamo_db_client.config.user_agent_frameworks << "aws-sessionstore-dynamodb"
151151
{:dynamo_db_client => dynamo_db_client}
152152
end
153153

spec/aws/session_store/dynamo_db/error/default_error_handler_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
end
2626

2727
let(:app) { RoutedRackApp.build(@options) }
28-
let(:client) { double('Aws::DynamoDB::Client') }
28+
let(:client) { double('Aws::DynamoDB::Client', config: double(user_agent_frameworks: [])) }
2929

3030
context 'Error handling for Rack Middleware with default error handler' do
3131
it 'catches exception for inaccurate table name and raises error ' do

spec/aws/session_store/dynamo_db/garbage_collection_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ def collect_garbage
124124
expect(dynamo_db_client).to receive(:scan).
125125
exactly(1).times.and_return(scan_resp3)
126126
expect(dynamo_db_client).to receive(:batch_write_item).ordered.
127-
with(request_items: { 'sessions' => format_scan_result }).
127+
with({request_items: { 'sessions' => format_scan_result }}).
128128
and_return(write_resp2)
129-
expect(dynamo_db_client).to receive(:batch_write_item).ordered.with(
129+
expect(dynamo_db_client).to receive(:batch_write_item).ordered.with({
130130
request_items: {
131131
'sessions' => [
132132
{
@@ -151,7 +151,7 @@ def collect_garbage
151151
}
152152
]
153153
}
154-
).and_return(write_resp1)
154+
}).and_return(write_resp1)
155155
collect_garbage
156156
end
157157
end

spec/aws/session_store/dynamo_db/rack_middleware_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def ensure_data_updated(mutated_data)
5151
list_tables: { table_names: ['Sessions'] },
5252
get_item: { item: { 'data' => sample_packed_data } },
5353
put_item: { attributes: { created_at: 'now' } },
54-
update_item: { attributes: { updated_at: 'now' } }
54+
update_item: { attributes: { updated_at: 'now' } },
55+
config: double(user_agent_frameworks: [])
5556
)
5657
end
5758

0 commit comments

Comments
 (0)