Sha256: 49568ddd747234354f2967e7ba92daacfffdb002592afb4b8f9983c05b20fd51

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

require 'json'
require 'spec_helper'
require 'fluent/gcprofiler'

describe Fluent::Gcprofiler do
  CONFIG_PATH = File.join(File.dirname(__FILE__), 'fluent.conf')
  BIN_DIR = File.join(ROOT, 'bin')
  OUTPUT_FILE = File.join(File.dirname(__FILE__), 'test.txt')

  context '#parse_options' do
    it 'incorrect subcommand' do
      expect { Fluent::Gcprofiler.new.parse_options(['foo']) }.to raise_error(OptionParser::InvalidOption)
    end
  end

  context 'profiling' do
    before :all do
      @fluentd_pid = spawn('fluentd', '-c', CONFIG_PATH, out: '/dev/null')
      sleep 2

      system("#{File.join(BIN_DIR, 'fluent-gcprofiler')} start")

      system("#{File.join(BIN_DIR, 'fluent-gcprofiler')} gc")

      system("#{File.join(BIN_DIR, 'fluent-gcprofiler')} stop -o #{OUTPUT_FILE}")
      sleep 1
    end

    after :all do
      Process.kill(:TERM, @fluentd_pid)
      Process.waitall
    end

    it 'should output' do
      expect(File.size?(OUTPUT_FILE)).to be_truthy
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-gcprofiler-0.0.1 spec/fluent-gcprofiler/gcprofiler_spec.rb