"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/test/unit/plugins/provisioners/ansible/cap/guest/debian/ansible_install_test.rb" (20 Nov 2020, 1741 Bytes) of package /linux/misc/vagrant-2.2.14.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 require_relative "../../../../../../base"
    2 require_relative "../shared/pip_ansible_install_examples"
    3 
    4 
    5 require Vagrant.source_root.join("plugins/provisioners/ansible/cap/guest/debian/ansible_install")
    6 
    7 
    8 describe VagrantPlugins::Ansible::Cap::Guest::Debian::AnsibleInstall do
    9   include_context "unit"
   10 
   11   subject { VagrantPlugins::Ansible::Cap::Guest::Debian::AnsibleInstall }
   12 
   13   let(:iso_env) do
   14     # We have to create a Vagrantfile so there is a root path
   15     env = isolated_environment
   16     env.vagrantfile("")
   17     env.create_vagrant_env
   18   end
   19 
   20   let(:machine) { iso_env.machine(iso_env.machine_names[0], :dummy) }
   21   let(:communicator) { double("comm") }
   22 
   23   before do
   24     allow(machine).to receive(:communicate).and_return(communicator)
   25     allow(communicator).to receive(:execute).and_return(true)
   26   end
   27 
   28   describe "#ansible_install" do
   29 
   30     it_behaves_like "Ansible setup via pip on Debian-based systems"
   31 
   32     describe "when install_mode is :default (or unknown)" do
   33       it "installs ansible with apt package manager" do
   34         install_backports_if_wheezy_release = <<INLINE_CRIPT
   35 CODENAME=`lsb_release -cs`
   36 if [ x$CODENAME == 'xwheezy' ]; then
   37   echo 'deb http://http.debian.net/debian wheezy-backports main' > /etc/apt/sources.list.d/wheezy-backports.list
   38 fi
   39 INLINE_CRIPT
   40 
   41         expect(communicator).to receive(:sudo).once.ordered.with(install_backports_if_wheezy_release)
   42         expect(communicator).to receive(:sudo).once.ordered.with("apt-get update -y -qq")
   43         expect(communicator).to receive(:sudo).once.ordered.with("DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --option \"Dpkg::Options::=--force-confold\" ansible")
   44 
   45         subject.ansible_install(machine, :default, "", "", "")
   46       end
   47     end
   48   end
   49 
   50 end