Sha256: 9ab2cfb89135a35019cf069245200bbc1a629e5890af4e94984ea6c16cff3feb

Contents?: true

Size: 1.75 KB

Versions: 22

Compression:

Stored size: 1.75 KB

Contents

require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'

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

  context '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

22 entries across 22 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.0.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.18.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.17.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.17.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.16.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.16.3 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.16.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.16.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.16.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.15.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.14.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.13.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.13.3 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.13.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.13.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.13.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.12.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.11.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.11.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb
hybrid_platforms_conductor-32.11.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/state_spec.rb