Sha256: b57ed5c4f00a8c678f933325f225ab32b7f8624ae22789742407ce9dde182917

Contents?: true

Size: 1.67 KB

Versions: 31

Compression:

Stored size: 1.67 KB

Contents

require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'

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

  context 'when checking containers IP retrieval' do

    it 'returns the IP of a newly 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
        ]
        instance.create
        expect(instance.ip).to eq '192.168.0.100'
      end
    end

    it 'returns the IP of a reused instance' do
      with_test_proxmox_platform do |instance|
        mock_proxmox_calls_with(
          [
            # 1 - The info on existing containers
            mock_proxmox_to_get_nodes_info(
              nodes_info: [
                {
                  'status' => 'online',
                  'node' => 'pve_node_name'
                }
              ],
              extra_expects: proc do |proxmox|
                expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc').and_return [
                  {
                    'vmid' => '1042'
                  }
                ]
                expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc/1042/config').and_return(
                  'net0' => 'ip=192.168.42.101/32',
                  'description' => <<~EO_DESCRIPTION
                    ===== HPC info =====
                    node: node
                    environment: test
                  EO_DESCRIPTION
                )
              end
            )
          ],
          reserve: false
        )
        instance.create
        expect(instance.ip).to eq '192.168.42.101'
      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/ip_spec.rb
hybrid_platforms_conductor-33.9.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.9.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.9.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.9.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.8.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.8.3 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.8.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.8.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.8.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.7.4 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.7.3 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.7.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.7.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.7.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.6.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.5.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.5.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.4.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-33.3.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb