File: test_resource_quota.rb

package info (click to toggle)
ruby-kubeclient 4.13.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,128 kB
  • sloc: ruby: 4,229; makefile: 6
file content (25 lines) | stat: -rw-r--r-- 810 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

require_relative 'test_helper'

# ResourceQuota tests
class TestResourceQuota < Minitest::Test
  def test_get_from_json_v1
    stub_core_api_list
    stub_request(:get, %r{/resourcequotas})
      .to_return(body: open_test_file('resource_quota.json'),
                 status: 200)

    client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
    quota = client.get_resource_quota('quota', 'quota-example')

    assert_instance_of(Kubeclient::Resource, quota)
    assert_equal('quota', quota.metadata.name)
    assert_equal('20', quota.spec.hard.cpu)
    assert_equal('10', quota.spec.hard.secrets)

    assert_requested(:get,
                     'http://localhost:8080/api/v1/namespaces/quota-example/resourcequotas/quota',
                     times: 1)
  end
end