Sha256: 38739d654c031caa5c2ed91b2be57c3d826139f1c044b7fd9f37b7251fe7ada2

Contents?: true

Size: 1 KB

Versions: 11

Compression:

Stored size: 1 KB

Contents

module Environment
  def setup
    super
    FileUtils.cp_r $base_dir.join('support', 'environment_cookbook'), 'site-cookbooks/environment_cookbook'
    FileUtils.cp $base_dir.join('support', 'test_environment.json'), 'environments/test_environment.json'
  end

  def cook_environment(node)
    write_nodefile(node)
    assert_subcommand "cook"
    `ssh #{connection_string} cat /etc/chef_environment`
  end

  # Test that chef picks up environments properly
  # NOTE: This shells out to ssh, so may not be windows-compatible
  def test_chef_environment
    # If no environment is specified chef needs to use "_default" and attribute from cookbook
    actual = cook_environment(run_list: ["recipe[environment_cookbook]"])
    assert_equal "_default/untouched", actual

    # If one is specified chef needs to pick it up and get override attibute
    actual = cook_environment(run_list: ["recipe[environment_cookbook]"], environment: 'test_environment')
    assert_equal "test_environment/test_env_was_here", actual
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
knife-solo-0.7.0 test/integration/cases/environment.rb
knife-solo-0.7.0.pre3 test/integration/cases/environment.rb
knife-solo-0.7.0.pre2 test/integration/cases/environment.rb
knife-solo-0.7.0.pre test/integration/cases/environment.rb
knife-solo-0.6.0 test/integration/cases/environment.rb
knife-solo-0.4.3 test/integration/cases/environment.rb
knife-solo-0.5.1 test/integration/cases/environment.rb
knife-solo-0.5.0 test/integration/cases/environment.rb
knife-solo-0.4.2 test/integration/cases/environment.rb
knife-solo-0.4.1 test/integration/cases/environment.rb
knife-solo-0.4.0 test/integration/cases/environment.rb