Skip to content

Commit bdade61

Browse files
committed
add integration tests for cgroups v1 and v2
1 parent 9a5ec4c commit bdade61

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

qa/docker/shared_examples/container.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,21 @@
8787
expect(java_process(@container)["args"]).to match /-Dls.cgroup.cpuacct.path.override=/
8888
end
8989

90+
it 'should report cgroup cpu and cpuacct stats via the monitoring API' do
91+
node_stats = get_node_stats(@container)
92+
cgroup = node_stats.dig('os', 'cgroup')
93+
expect(cgroup).not_to be_nil, "Expected cgroup stats in /_node/stats response"
94+
95+
expect(cgroup.dig('cpuacct', 'control_group')).to be_a(String)
96+
expect(cgroup.dig('cpuacct', 'usage_nanos')).to be >= 0
97+
98+
expect(cgroup.dig('cpu', 'control_group')).to be_a(String)
99+
expect(cgroup.dig('cpu', 'cfs_period_micros')).to be > 0
100+
expect(cgroup.dig('cpu', 'stat', 'number_of_elapsed_periods')).to be >= -1
101+
expect(cgroup.dig('cpu', 'stat', 'number_of_times_throttled')).to be >= -1
102+
expect(cgroup.dig('cpu', 'stat', 'time_throttled_nanos')).to be >= -1
103+
end
104+
90105
it 'should have a pid of 1' do
91106
expect(java_process(@container)["pid"]).to eql '1'
92107
end

0 commit comments

Comments
 (0)