hoodoo 1.15.0 → 1.15.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 +4 -4
- data/lib/hoodoo/client/client.rb +2 -2
- data/lib/hoodoo/client/endpoint/endpoints/auto_session.rb +2 -3
- data/lib/hoodoo/services/services/interface.rb +1 -1
- data/lib/hoodoo/version.rb +1 -1
- data/spec/client/client_spec.rb +37 -0
- data/spec/services/services/session_spec.rb +22 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1074a01d7b0b249400765334f2991cd5c00b9e85
|
|
4
|
+
data.tar.gz: 2e2473fbe2031ea3433a660e4a7bdc80a5012e03
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89f72453d4d3ba63e7d22676864171272fb2a8fb6caf5c38704ca3993fbde88a3993f7e1f6cd70b6fa880ba2e439171b975cf33db6a27a91e81dd382de45092a
|
|
7
|
+
data.tar.gz: 3c1e9c6dc2e6f00955869055cee8f431364b3891fa72f68d2f7ca9dc6cfd6886d1501228d53aa2e95d4a7886362f193f96c2d4f77b7de8d3ba2c71fb30a57f6d
|
data/lib/hoodoo/client/client.rb
CHANGED
|
@@ -67,8 +67,8 @@ module Hoodoo
|
|
|
67
67
|
# :limit => 25,
|
|
68
68
|
# :sort => :created_at,
|
|
69
69
|
# :direction => :asc,
|
|
70
|
-
# :
|
|
71
|
-
# :
|
|
70
|
+
# :search => { :surname => 'Smith' },
|
|
71
|
+
# :_embed => 'account'
|
|
72
72
|
# )
|
|
73
73
|
#
|
|
74
74
|
# This will return a Hoodoo::Client::AugmentedArray. This is an Array
|
|
@@ -134,12 +134,11 @@ module Hoodoo
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
result = @wrapped_endpoint.send( action, *args )
|
|
137
|
-
bad_session = result.platform_errors.
|
|
138
|
-
result.platform_errors.errors.find do | error_hash |
|
|
137
|
+
bad_session = result.platform_errors.errors.find do | error_hash |
|
|
139
138
|
error_hash[ 'code' ] == 'platform.invalid_session'
|
|
140
139
|
end
|
|
141
140
|
|
|
142
|
-
if bad_session
|
|
141
|
+
if bad_session.nil?
|
|
143
142
|
return result
|
|
144
143
|
else
|
|
145
144
|
session_creation_result = acquire_session_for( action )
|
|
@@ -487,7 +487,7 @@ module Hoodoo; module Services
|
|
|
487
487
|
# Example: An interface permits lists that request embedding or
|
|
488
488
|
# referencing of "vouchers", "balances" and "member":
|
|
489
489
|
#
|
|
490
|
-
#
|
|
490
|
+
# embeds :vouchers, :balances, :member
|
|
491
491
|
#
|
|
492
492
|
# As a result, #embeds would return:
|
|
493
493
|
#
|
data/lib/hoodoo/version.rb
CHANGED
data/spec/client/client_spec.rb
CHANGED
|
@@ -985,6 +985,43 @@ describe Hoodoo::Client do
|
|
|
985
985
|
expect( result.platform_errors.has_errors? ).to eq( false )
|
|
986
986
|
end
|
|
987
987
|
|
|
988
|
+
it 'does not retry for errors other than "platform.invalid_session"' do
|
|
989
|
+
|
|
990
|
+
# When we list first, Client has no session so will acquire one. The
|
|
991
|
+
# wrapping endpoint is asked to list, it pushes that through the
|
|
992
|
+
# session mechanism, gets the session and then calls the wrapped
|
|
993
|
+
# endpoint.
|
|
994
|
+
|
|
995
|
+
expect( @endpoint ).to receive( :acquire_session_for ).once.with( :list ).and_call_original
|
|
996
|
+
expect( @endpoint.instance_variable_get( '@wrapped_endpoint' ) ).to receive( :list ).once.and_call_original
|
|
997
|
+
|
|
998
|
+
result = @endpoint.list()
|
|
999
|
+
expect( result.platform_errors.has_errors? ).to eq( false )
|
|
1000
|
+
|
|
1001
|
+
# When we list the second time, the wrapping endpoint has a session
|
|
1002
|
+
# but we fake a simple "generic.malformed" response from the wrapped
|
|
1003
|
+
# endpoint (probably impossible from a 'list' call in reality, but
|
|
1004
|
+
# just some easy error that we can check for afterwards and is not as
|
|
1005
|
+
# likely to be generated incidentally from other pieces of code as
|
|
1006
|
+
# e.g. "generic.invalid_parameters").
|
|
1007
|
+
|
|
1008
|
+
expect( @endpoint.instance_variable_get( '@wrapped_endpoint' ) ).to receive( :list ).once do
|
|
1009
|
+
array = Hoodoo::Client::AugmentedArray.new
|
|
1010
|
+
array.platform_errors.add_error( 'generic.malformed' )
|
|
1011
|
+
array
|
|
1012
|
+
end
|
|
1013
|
+
|
|
1014
|
+
# This is just a normal error; we do not expect another session
|
|
1015
|
+
# acquisition attempt or a retried call to #list.
|
|
1016
|
+
|
|
1017
|
+
expect( @endpoint ).to_not receive( :acquire_session_for )
|
|
1018
|
+
expect( @endpoint.instance_variable_get( '@wrapped_endpoint' ) ).to_not receive( :list )
|
|
1019
|
+
|
|
1020
|
+
result = @endpoint.list()
|
|
1021
|
+
expect( result.platform_errors.has_errors? ).to eq( true )
|
|
1022
|
+
expect( result.platform_errors.errors[ 0 ][ 'code' ] ).to eq( 'generic.malformed' )
|
|
1023
|
+
end
|
|
1024
|
+
|
|
988
1025
|
it 'handles errors from the session resource' do
|
|
989
1026
|
expect_any_instance_of( RSpecClientTestSessionImplementation ).to receive( :create ).and_raise( "boo!" )
|
|
990
1027
|
|
|
@@ -453,7 +453,28 @@ describe Hoodoo::Services::Session do
|
|
|
453
453
|
expect( s.save_to_store() ).to eq( :fail )
|
|
454
454
|
end
|
|
455
455
|
|
|
456
|
-
it 'handles unknown Hoodoo::TransientStore engine failures' do
|
|
456
|
+
it 'handles unknown Hoodoo::TransientStore engine failures when saving' do
|
|
457
|
+
s = described_class.new(
|
|
458
|
+
:session_id => '1234',
|
|
459
|
+
:memcached_host => 'abcd',
|
|
460
|
+
:caller_id => '0987',
|
|
461
|
+
:caller_version => 1
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
expect_any_instance_of( Hoodoo::TransientStore::Memcached ).to receive( :set ).once.and_call_original
|
|
465
|
+
expect_any_instance_of( Hoodoo::TransientStore::Memcached ).to receive( :set ).once.and_return( false )
|
|
466
|
+
|
|
467
|
+
expect( Hoodoo::Services::Middleware.logger ).to(
|
|
468
|
+
receive( :warn ).once.with(
|
|
469
|
+
'Hoodoo::Services::Session\\#save_to_store: Session saving failed - connection fault or session corrupt',
|
|
470
|
+
'Unknown storage engine failure'
|
|
471
|
+
).and_call_original
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
expect( s.save_to_store() ).to eq( :fail )
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
it 'handles unknown Hoodoo::TransientStore engine failures when deleting' do
|
|
457
478
|
s = described_class.new(
|
|
458
479
|
:session_id => '1234',
|
|
459
480
|
:memcached_host => 'abcd',
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hoodoo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.15.
|
|
4
|
+
version: 1.15.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Loyalty New Zealand
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dalli
|