Sha256: be407a4dc0ed355d3cc0039367bfeeafe5b4586bbe953f14110edcefbcd6613e

Contents?: true

Size: 1.82 KB

Versions: 57

Compression:

Stored size: 1.82 KB

Contents

require 'spec_helper'
include Beaker::DSL::InstallUtils::CAUtils

describe Beaker::DSL::InstallUtils::CAUtils do
  let(:dummy_pki) {
      {
        :root_cert => 'dummy_root_cert',
        :int_cert => 'dummy_int_cert',
        :int_ca_bundle => 'dummy_int_bundle',
        :int_key  => 'dummy_int_key',
        :int_crl_chain => 'dummy_int_crl_chain',
      }
    }

    before(:each) do
      allow(subject).to receive(:create_chained_pki).and_return(dummy_pki)
    end

  describe 'generate_ca_bundle_on' do
    let(:host) { make_host( 'unixhost', { :platform => 'linux'})}
    let(:bundledir) { '/tmp/ca_bundle' }
    let(:expected) { 
      {
        :root_cert => "#{bundledir}/root_cert",
        :int_cert => "#{bundledir}/int_cert",
        :int_ca_bundle => "#{bundledir}/int_ca_bundle",
        :int_key => "#{bundledir}/int_key",
        :int_crl_chain => "#{bundledir}/int_crl_chain",
      }
    }

    it "generates certs on host" do
      expect(subject).to receive(:on).with(host, "mkdir -p #{bundledir}", :acceptable_exit_codes => [0])
      expect(subject).to receive(:create_remote_file).with(host,"#{bundledir}/root_cert", "dummy_root_cert", :acceptable_exit_codes => [0])
      expect(subject).to receive(:create_remote_file).with(host,"#{bundledir}/int_cert", "dummy_int_cert", :acceptable_exit_codes => [0])
      expect(subject).to receive(:create_remote_file).with(host,"#{bundledir}/int_ca_bundle", "dummy_int_bundle", :acceptable_exit_codes => [0])
      expect(subject).to receive(:create_remote_file).with(host,"#{bundledir}/int_key", "dummy_int_key", :acceptable_exit_codes => [0])
      expect(subject).to receive(:create_remote_file).with(host,"#{bundledir}/int_crl_chain", "dummy_int_crl_chain", :acceptable_exit_codes => [0])
      expect( subject.generate_ca_bundle_on(host,"#{bundledir}") ).to eq(expected)
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
beaker-pe-3.4.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-3.3.1 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.19.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-3.3.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.18.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-3.2.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-3.0.1 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.16.1 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-3.0.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.16.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.15.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.14.1 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.14.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.13.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.12.0 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.11.24 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.11.23 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.11.22 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.11.21 spec/beaker-pe/install/ca_utils_spec.rb
beaker-pe-2.11.20 spec/beaker-pe/install/ca_utils_spec.rb