File: test_component_status.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 (31 lines) | stat: -rw-r--r-- 943 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
26
27
28
29
30
31
# frozen_string_literal: true

require_relative 'test_helper'

# ComponentStatus tests
class TestComponentStatus < Minitest::Test
  def test_get_from_json_v3
    stub_core_api_list
    stub_request(:get, %r{/componentstatuses})
      .to_return(body: open_test_file('component_status.json'), status: 200)

    client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
    component_status = client.get_component_status('etcd-0', 'default')

    assert_instance_of(Kubeclient::Resource, component_status)
    assert_equal('etcd-0', component_status.metadata.name)
    assert_equal('Healthy', component_status.conditions[0].type)
    assert_equal('True', component_status.conditions[0].status)

    assert_requested(
      :get,
      'http://localhost:8080/api/v1',
      times: 1
    )
    assert_requested(
      :get,
      'http://localhost:8080/api/v1/namespaces/default/componentstatuses/etcd-0',
      times: 1
    )
  end
end