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-32.10.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.9.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.9.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.8.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.8.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.8.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.7.3 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.7.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.7.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.7.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.6.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.5.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.4.2 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.4.1 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.4.0 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb
hybrid_platforms_conductor-32.3.6 spec/hybrid_platforms_conductor_test/api/deployer/provisioners/proxmox/ip_spec.rb