-
-
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
Aws::DynamoDB::Client describe_table returning nil with VCR #270
Comments
I may guess the table isn't created yet. Table creation is asynchronous operation in You can check it by passing Default values are: config.sync_retry_wait_seconds = 0
config.sync_retry_max_times = 3 |
I put the following in my DynamoidReset module, as pointed by https://www.rubydoc.info/gems/dynamoid/2.2.0#Test_Environment: Dynamoid.included_models.each do |model|
begin
model.create_table(sync: true)
rescue
retry
end
end Still getting the same error. |
I configured VCR to ignore all request to localhost and also configured dynamoid with: module DynamoidTruncate
def self.all
if Dynamoid.adapter.list_tables
Dynamoid.adapter.list_tables.each do |table|
if table =~ /^#{Dynamoid::Config.namespace}/
Dynamoid.adapter.truncate(table)
end
end
end
Dynamoid.included_models.each(&:create_table)
end
end
RSpec.configure do |config|
config.before(:suite) do
Dynamoid.included_models.each do |model|
begin
model.create_table(sync: true)
rescue
retry
end
end
end
config.before(:each) do
DynamoidTruncate.all
end
end It's working know 🎉 |
Actually it makes sense to create table synchronously as well here in
|
I decided to not drop my tables, only truncate it. I run |
While using Dynamoid with VCR I started to perceive random failures on my tests. I can't identify the root of the problem, but I think it's something related with
Aws::DynamoDB::Client
describe_table
method.This is the the stacktrace of the error during the test execution:
The problem in this method is that
schema
is nil, this is the content of thehash_key
method:I put a breakpoint in
dynamoid-2.2.0/lib/dynamoid/adapter_plugin/aws_sdk_v2.rb @ line 804 Dynamoid::AdapterPlugin::AwsSdkV2#describe_table:
and this is the output of some calls I have made manually:I'm using a local dynamodb with the
dynamodb-local
gem. I also used a dynamodb in AWS and have the same error.Appreciate any help with this issue, thanks!
The text was updated successfully, but these errors were encountered: