Sha256: 993d274e6fc7ce4b67212ebbe29dff5af5fafa01ca76a3886ae7e9fe96d2455d

Contents?: true

Size: 1.76 KB

Versions: 31

Compression:

Stored size: 1.76 KB

Contents

require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'

describe HybridPlatformsConductor::HpcPlugins::Provisioner::Proxmox do

  context 'when checking containers state' do

    it 'gets the status of a missing instance' do
      with_test_proxmox_platform do |instance|
        expect(instance.state).to eq :missing
      end
    end

    it 'gets the status of a created instance' do
      with_test_proxmox_platform do |instance|
        mock_proxmox_calls_with [
          # 1 - The info on existing containers
          mock_proxmox_to_get_nodes_info,
          # 2 - The status of the container
          mock_proxmox_to_status_node
        ]
        instance.create
        expect(instance.state).to eq :created
      end
    end

    it 'retries calls to the API when getting back errors 5xx' do
      with_test_proxmox_platform do |instance|
        mock_proxmox_calls_with [
          # 1 - The info on existing containers
          mock_proxmox_to_get_nodes_info,
          # 2 - The status of the container
          mock_proxmox_to_status_node(nbr_api_errors: 3)
        ]
        instance.create
        expect(instance.state).to eq :created
      end
    end

    it 'fails to get an instance\'s status when the Proxmox API fails too many times' do
      with_test_proxmox_platform do |instance|
        mock_proxmox_calls_with [
          # 1 - The info on existing containers
          mock_proxmox_to_get_nodes_info,
          # 2 - The status of the container
          mock_proxmox_to_status_node(nbr_api_errors: 4, status: nil)
        ]
        instance.create
        expect { instance.state }.to raise_error '[ node/test ] - Proxmox API call get nodes/pve_node_name/lxc returns NOK: error code = 500 continuously (tried 4 times)'
      end
    end

  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.9.5 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.9.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.9.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.9.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.9.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.8.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.8.3 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.8.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.8.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.8.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.7.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.7.3 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.7.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.7.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.7.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.6.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.5.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.5.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.4.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-33.3.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb