Sha256: 5b178c2c838f8b43ab28faa36bfefec85e098f48644e535b3c9ace623198657c

Contents?: true

Size: 1.45 KB

Versions: 96

Compression:

Stored size: 1.45 KB

Contents

shared_examples "provider/provisioner/shell" do |provider, options|
  if !options[:box]
    raise ArgumentError,
      "box_basic option must be specified for provider: #{provider}"
  end

  include_context "acceptance"

  before do
    environment.skeleton("provisioner_shell")
    assert_execute("vagrant", "box", "add", "box", options[:box])
    assert_execute("vagrant", "up", "--provider=#{provider}")
  end

  after do
    assert_execute("vagrant", "destroy", "--force")
  end

  it "provisions with the shell script" do
    status("Test: inline script")
    result = execute("vagrant", "ssh", "-c", "cat /foo")
    expect(result).to exit_with(0)
    expect(result.stdout).to match(/foo\n$/)

    status("Test: script from path")
    result = execute("vagrant", "ssh", "-c", "cat /vagrant-path")
    expect(result).to exit_with(0)
    expect(result.stdout).to match(/bar\n$/)

    status("Test: script with args")
    result = execute("vagrant", "ssh", "-c", "cat /vagrant-args")
    expect(result).to exit_with(0)
    expect(result.stdout).to match(/hello\ntwo words\n$/)

    status("Test: privileged scripts")
    result = execute("vagrant", "ssh", "-c", "cat /tmp/vagrant-user-root")
    expect(result).to exit_with(0)
    expect(result.stdout).to match(/root$/)

    status("Test: non-privileged scripts")
    result = execute("vagrant", "ssh", "-c", "cat /tmp/vagrant-user")
    expect(result).to exit_with(0)
    expect(result.stdout).to_not match(/root$/)
  end
end

Version data entries

96 entries across 29 versions & 2 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/acceptance/provisioner/shell_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/provisioner/shell_spec.rb