Sha256: f775db37d7d161060d53a059631ad1683720357a827a72a3d2bd51897dbc7c53

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8
shared_context "setup plugin" do
  let(:temporary_directory) { Stud::Temporary.pathname }

  let(:bucket) { ENV["AWS_LOGSTASH_TEST_BUCKET"] }
  let(:access_key_id) {  ENV["AWS_ACCESS_KEY_ID"] }
  let(:secret_access_key) { ENV["AWS_SECRET_ACCESS_KEY"] }
  let(:size_file) { 100 }
  let(:time_file) { 100 }
  let(:tags) { [] }
  let(:prefix) { "home" }
  let(:region) { "us-east-1" }

  let(:main_options) do
    {
      "bucket" => bucket,
      "prefix" => prefix,
      "temporary_directory" => temporary_directory,
      "access_key_id" => access_key_id,
      "secret_access_key" => secret_access_key,
      "size_file" => size_file,
      "time_file" => time_file,
      "region" => region,
      "tags" => []
    }
  end

  let(:client_credentials) { Aws::Credentials.new(access_key_id, secret_access_key) }
  let(:bucket_resource) { Aws::S3::Bucket.new(bucket, { :credentials => client_credentials, :region => region }) }

  subject { LogStash::Outputs::S3.new(options) }
end

def clean_remote_files(prefix = "")
  bucket_resource.objects(:prefix => prefix).each do |object|
    object.delete
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logstash-output-s3-4.0.1 spec/supports/helpers.rb
logstash-output-s3-4.0.0 spec/supports/helpers.rb