-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model.find raise error in test env #486
Comments
Could you please provide an example of test to reproduce the issue? |
I've reproduced the issue and I wouldn't consider it as a bug in Dynamoid. Dynamoid relies on a table schema declared in a model class (range and hash keys at least). But there are some places when Dynamoid loads actual table meta information with DescribeTable api call (documentation). As far as I understand stubbing client responses with Example of the stubbed response for the DescribeTable api call which AWS SDK returns in "stub_responses" mode: A real table schema looks like this one: As you can see stubbed response contains empty key schema - So what options I could suggest.
DescribeTable call can be stubbed this way: Aws.config[:dynamodb] = {
stub_responses: {
describe_table: {
table: { :key_schema=>[{ attribute_name: 'id', key_type: 'HASH' }] }
}
}
} By default Dynamoid uses I checked this approach - |
Hi @andrykonchin. Thanks for fist replay and provided solution, it works for us :) |
In our project, we have a simple table using DynamoDB. We are using the
find
method to find the record and It works fine in production and development ENVs but in test env, it raises a strange error aboutundefined method
to_sym' for nil:NilClassin
gems/dynamoid-3.6.0/lib/dynamoid/adapter_plugin/aws_sdk_v3.rb:567:inkey_stanza'
. In the spec_helper we haveAws.config[:dynamodb] = { stub_responses: true }
to stub the responses.The text was updated successfully, but these errors were encountered: