"Fossies" - the Fresh Open Source Software Archive

Member "vagrant-2.2.14/test/unit/plugins/provisioners/ansible/cap/guest/alpine/ansible_install_test.rb" (20 Nov 2020, 2069 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 require Vagrant.source_root.join("plugins/provisioners/ansible/cap/guest/alpine/ansible_install")
    5 
    6 describe VagrantPlugins::Ansible::Cap::Guest::Alpine::AnsibleInstall do
    7   include_context "unit"
    8 
    9   subject { VagrantPlugins::Ansible::Cap::Guest::Alpine::AnsibleInstall }
   10 
   11   let(:iso_env) do
   12     # We have to create a Vagrantfile so there is a root path
   13     env = isolated_environment
   14     env.vagrantfile("")
   15     env.create_vagrant_env
   16   end
   17 
   18   let(:machine) { iso_env.machine(iso_env.machine_names[0], :dummy) }
   19   let(:communicator) { double("comm") }
   20 
   21   before do
   22     allow(machine).to receive(:communicate).and_return(communicator)
   23     allow(communicator).to receive(:execute).and_return(true)
   24   end
   25 
   26   describe "#pip_setup" do
   27     it "install required alpine packages for pip" do
   28       expect(communicator).to receive(:sudo).once.ordered.
   29         with("apk add --update --no-cache python3")
   30       expect(communicator).to receive(:sudo).once.ordered.
   31         with("if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi")
   32       expect(communicator).to receive(:sudo).once.ordered.
   33         with("apk add --update --no-cache --virtual .build-deps python3-dev libffi-dev openssl-dev build-base")
   34 
   35       subject.pip_setup(machine)
   36     end
   37   end
   38 
   39   describe "#ansible_install" do
   40 
   41     it_behaves_like "Ansible setup via pip"
   42 
   43     describe "when install_mode is :default (or unknown)" do
   44       it "installs ansible with 'apk' package manager" do
   45         expect(communicator).to receive(:sudo).once.ordered.
   46             with("apk add --update --no-cache python3 ansible")
   47         expect(communicator).to receive(:sudo).once.ordered.
   48             with("if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi")
   49         expect(communicator).to receive(:sudo).once.ordered.
   50             with("if [ ! -e /usr/bin/pip ]; then ln -sf pip3 /usr/bin/pip ; fi")
   51 
   52         subject.ansible_install(machine, :default, "", "", "")
   53       end
   54     end
   55   end
   56 
   57 end