Sha256: 76935106ab15392f60e455dfc09474739cb7251f65e5a7b18089643482743d2e

Contents?: true

Size: 1.81 KB

Versions: 31

Compression:

Stored size: 1.81 KB

Contents

describe HybridPlatformsConductor::NodesHandler do

  context 'checking config DSL' do

    it 'adds helpers for master cmdbs' do
      with_test_platform(
        {
          nodes: {
            'node1' => {},
            'node2' => {},
            'node3' => {}
          }
        },
        false,
        '
          master_cmdbs(
            test_cmdb: :property1,
            test_cmdb2: :property2
          )
          for_nodes(\'node2\') do
            master_cmdbs(test_cmdb: :property3)
          end
        '
      ) do
        register_test_cmdb(%i[test_cmdb test_cmdb2])
        expect(test_config.cmdb_masters).to eq [
          {
            nodes_selectors_stack: [],
            cmdb_masters: {
              test_cmdb: [:property1],
              test_cmdb2: [:property2]
            }
          },
          {
            nodes_selectors_stack: ['node2'],
            cmdb_masters: {
              test_cmdb: [:property3]
            }
          }
        ]
      end
    end

    it 'adds helpers for configurable sudo' do
      with_test_platform(
        {
          nodes: {
            'node1' => {},
            'node2' => {},
            'node3' => {}
          }
        },
        false,
        '
          sudo_for { |user| "alt_sudo1 -p #{user}" }
          for_nodes(\'node2\') do
            sudo_for { |user| "alt_sudo2 -q #{user}" }
          end
        '
      ) do
        expect(test_config.sudo_procs.size).to eq 2
        expect(test_config.sudo_procs[0][:nodes_selectors_stack]).to eq []
        expect(test_config.sudo_procs[0][:sudo_proc].call('test_user')).to eq 'alt_sudo1 -p test_user'
        expect(test_config.sudo_procs[1][:nodes_selectors_stack]).to eq ['node2']
        expect(test_config.sudo_procs[1][:sudo_proc].call('test_user')).to eq 'alt_sudo2 -q test_user'
      end
    end

  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

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