Allow ddb devutils client override

refs FOO-925

Change-Id: I24e54c5afa0f2230b63c90c470d5c59dfdabbccb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246806
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
This commit is contained in:
Ethan Vizitei 2020-09-02 12:42:25 -05:00
parent 90292a83dd
commit dc25bfb3ce
2 changed files with 4 additions and 4 deletions

View File

@ -6,12 +6,12 @@
# shaped like the example below. Each environment can get a hash, # shaped like the example below. Each environment can get a hash,
# there's a key for each read path, and a hash for the returned data # there's a key for each read path, and a hash for the returned data
development: development:
'sts/testaccount/sts/canvas-shards-lookuper-dev': 'sts/testaccount/sts/canvas-shards-lookupper-dev':
access_key: 'fake-access-key' access_key: 'fake-access-key'
secret_key: 'fake-secret-key' secret_key: 'fake-secret-key'
security_token: 'fake-security-token' security_token: 'fake-security-token'
test: test:
'sts/testaccount/sts/canvas-shards-lookuper-test': 'sts/testaccount/sts/canvas-shards-lookupper-test':
access_key: 'fake-access-key' access_key: 'fake-access-key'
secret_key: 'fake-secret-key' secret_key: 'fake-secret-key'
security_token: 'fake-security-token' security_token: 'fake-security-token'

View File

@ -31,11 +31,11 @@ module Canvas
} }
}.freeze }.freeze
def self.initialize_ddb_for_development!(category, table_name, recreate: false, schema: nil) def self.initialize_ddb_for_development!(category, table_name, recreate: false, schema: nil, ddb: nil)
unless ["development", "test"].include?(Rails.env) unless ["development", "test"].include?(Rails.env)
raise "DynamoDB should not be initialized this way in a real environment!!!" raise "DynamoDB should not be initialized this way in a real environment!!!"
end end
canvas_ddb = Canvas::DynamoDB::DatabaseBuilder.from_config(category) canvas_ddb = ddb || Canvas::DynamoDB::DatabaseBuilder.from_config(category)
dynamodb = canvas_ddb.client dynamodb = canvas_ddb.client
local_table_name = canvas_ddb.prefixed_table_name(table_name) local_table_name = canvas_ddb.prefixed_table_name(table_name)
exists = begin exists = begin