debian-mirror-gitlab/spec/lib/gitlab/metrics/system_spec.rb

62 lines
1.5 KiB
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Metrics::System do
if File.exist?('/proc')
describe '.memory_usage' do
it "returns the process' memory usage in bytes" do
expect(described_class.memory_usage).to be > 0
end
end
describe '.file_descriptor_count' do
it 'returns the amount of open file descriptors' do
expect(described_class.file_descriptor_count).to be > 0
end
end
2019-09-04 21:01:54 +05:30
describe '.max_open_file_descriptors' do
it 'returns the max allowed open file descriptors' do
expect(described_class.max_open_file_descriptors).to be > 0
end
end
else
describe '.memory_usage' do
it 'returns 0.0' do
expect(described_class.memory_usage).to eq(0.0)
end
end
describe '.file_descriptor_count' do
it 'returns 0' do
expect(described_class.file_descriptor_count).to eq(0)
end
end
2019-09-04 21:01:54 +05:30
describe '.max_open_file_descriptors' do
it 'returns 0' do
expect(described_class.max_open_file_descriptors).to eq(0)
end
end
end
2016-06-02 11:05:42 +05:30
describe '.cpu_time' do
2019-09-30 21:07:59 +05:30
it 'returns a Float' do
2018-03-17 18:26:18 +05:30
expect(described_class.cpu_time).to be_an(Float)
2016-08-24 12:49:21 +05:30
end
end
describe '.real_time' do
2019-09-30 21:07:59 +05:30
it 'returns a Float' do
2018-03-17 18:26:18 +05:30
expect(described_class.real_time).to be_an(Float)
2016-08-24 12:49:21 +05:30
end
end
describe '.monotonic_time' do
2018-03-17 18:26:18 +05:30
it 'returns a Float' do
expect(described_class.monotonic_time).to be_an(Float)
2016-06-02 11:05:42 +05:30
end
end
end