Sha256: 8911f0edfe30b76ba4628ce4bd4cee1851a2f474a414e38a81ae8738e9ddfc85
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
# encoding: utf-8 require "logstash/devutils/rspec/spec_helper" require "logstash/outputs/swift/size_rotation_policy" require "logstash/outputs/swift/temporary_file" require "fileutils" describe LogStash::Outputs::Swift::SizeRotationPolicy do subject { described_class.new(size_file) } let(:temporary_directory) { Stud::Temporary.directory } let(:temporary_file) { Stud::Temporary.file } let(:name) { "foobar" } let(:content) { "hello" * 1000 } let(:size_file) { 10 } # in bytes let(:file) { LogStash::Outputs::Swift::TemporaryFile.new(name, temporary_file, temporary_directory) } it "returns true if the size on disk is higher than the `size_file`" do file.write(content) file.fsync expect(subject.rotate?(file)).to be_truthy end it "returns false if the size is inferior than the `size_file`" do expect(subject.rotate?(file)).to be_falsey end it "raises an exception if the `size_file` is 0" do expect { described_class.new(0) }.to raise_error(LogStash::ConfigurationError, /need to be greather than 0/) end it "raises an exception if the `size_file` is < 0" do expect { described_class.new(-100) }.to raise_error(LogStash::ConfigurationError, /need to be greather than 0/) end context "#needs_periodic?" do it "return false" do expect(subject.needs_periodic?).to be_falsey end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-output-swift-0.1 | spec/outputs/swift/size_rotation_policy_spec.rb |