Sha256: 7d402221a46037e774376aee5fb82bad8b9e2c4560438e713a1e417caaa93b9f
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
require "codeclimate-test-reporter" CodeClimate::TestReporter.start require 'fluent/test' require 'fluent/plugin/in_dynamodb_streams' require 'aws-sdk' module DynamoDBStreamsTestHelper TEST_TABLE_NAME = "in_dynamodb_streams" private def dynamodb @ddb ||= Aws::DynamoDB::Client.new( region: 'ap-northeast-1', access_key_id: 'dummy', secret_access_key: 'dummy', endpoint: 'http://localhost:8000', ) end def create_table @stream_arn = dynamodb.create_table({ table_name: TEST_TABLE_NAME, key_schema: [ { attribute_name: "key", key_type: "HASH", } ], attribute_definitions: [ { attribute_name: "key", attribute_type: "S", } ], provisioned_throughput: { read_capacity_units: 1, write_capacity_units: 1, }, stream_specification: { stream_enabled: true, stream_view_type: "NEW_AND_OLD_IMAGES", } }).table_description.latest_stream_arn end def put_records(records) records.each do |r| dynamodb.put_item( table_name: TEST_TABLE_NAME, item: r, ) end end def delete_table dynamodb.list_tables.table_names.each do |t| if t == TEST_TABLE_NAME dynamodb.delete_table({ table_name: TEST_TABLE_NAME, }) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-dynamodb-streams-0.0.3 | test/test_helper.rb |
fluent-plugin-dynamodb-streams-0.0.2 | test/test_helper.rb |
fluent-plugin-dynamodb-streams-0.0.1 | test/test_helper.rb |