Sha256: 110d94a45b9b578d9ecde0163dfabd1166e0550f13cb3ff3a7a928edf7139735

Contents?: true

Size: 1.73 KB

Versions: 36

Compression:

Stored size: 1.73 KB

Contents

require 'hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox'

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

  context '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') do
                  [
                    {
                      'vmid' => '1042'
                    }
                  ]
                end
                expect(proxmox).to receive(:get).with('nodes/pve_node_name/lxc/1042/config') do
                  {
                    'net0' => 'ip=192.168.42.101/32',
                    'description' => <<~EOS
                      ===== HPC info =====
                      node: node
                      environment: test
                    EOS
                  }
                end
              end
            )
          ],
          reserve: false
        )
        instance.create
        expect(instance.ip).to eq '192.168.42.101'
      end
    end

  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

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