Sha256: 0e29e5fb71c39bfdb231be722b08abe244396d580a59f4ffcba2248e4399cb4a

Contents?: true

Size: 721 Bytes

Versions: 57

Compression:

Stored size: 721 Bytes

Contents

require "spec_helper"
require "gitlab_exporter/memstats"

describe GitLab::Exporter::MemStats do
  let(:pid) { 100 }
  let(:smaps_data) { File.open("spec/fixtures/smaps/sample.txt") }

  subject { described_class::Aggregator.new(pid) }

  before do
    expect(File).to receive(:open).with("/proc/#{pid}/smaps").and_yield(smaps_data)
  end

  it "parses the data properly" do
    expect(subject.valid?).to be_truthy

    nonzero_fields = %w[size rss shared_clean shared_dirty private_dirty pss]
    zero_fields = %w[private_clean swap]

    nonzero_fields.each do |field|
      expect(subject.totals[field]).to be > 0
    end

    zero_fields.each do |field|
      expect(subject.totals[field]).to eq(0)
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
gitlab-exporter-11.7.0 spec/memstats_spec.rb
gitlab-exporter-11.6.0 spec/memstats_spec.rb
gitlab-exporter-11.5.0 spec/memstats_spec.rb
gitlab-exporter-11.4.0 spec/memstats_spec.rb
gitlab-exporter-11.3.0 spec/memstats_spec.rb
gitlab-exporter-11.2.0 spec/memstats_spec.rb
gitlab-exporter-11.1.0 spec/memstats_spec.rb
gitlab-exporter-11.0.1 spec/memstats_spec.rb
gitlab-exporter-11.0.0 spec/memstats_spec.rb
gitlab-exporter-10.5.0 spec/memstats_spec.rb
gitlab-exporter-10.4.0 spec/memstats_spec.rb
gitlab-exporter-10.3.0 spec/memstats_spec.rb
gitlab-exporter-10.2.0 spec/memstats_spec.rb
gitlab-exporter-10.1.0 spec/memstats_spec.rb
gitlab-exporter-10.0.0 spec/memstats_spec.rb
gitlab-exporter-9.1.0 spec/memstats_spec.rb
gitlab-exporter-9.0.0 spec/memstats_spec.rb