spec/lib/packaging/config_spec.rb in packaging-0.88.77 vs spec/lib/packaging/config_spec.rb in packaging-0.99.0

- old
+ new

@@ -2,13 +2,11 @@ require 'spec_helper' require 'yaml' describe "Pkg::Config" do - Build_Params = [:apt_archive_path, - :apt_archive_repo_command, - :apt_host, + Build_Params = [:apt_host, :apt_releases, :apt_repo_path, :apt_repo_url, :apt_repo_name, :apt_repo_command, @@ -34,15 +32,13 @@ :debug, :default_cow, :default_mock, :description, :dmg_path, - :downloads_archive_path, :email, :files, :final_mocks, - :freight_archive_path, :freight_conf, :gem_default_executables, :gem_dependencies, :gem_description, :gem_devel_dependencies, @@ -82,11 +78,10 @@ :name, :nonfinal_apt_repo_command, :nonfinal_apt_repo_path, :nonfinal_apt_repo_staging_path, :nonfinal_dmg_path, - :nonfinal_gem_path, :nonfinal_ips_path, :nonfinal_msi_path, :nonfinal_p5p_path, :nonfinal_repo_name, :nonfinal_repo_link_target, @@ -130,11 +125,10 @@ :templates, :update_version_file, :version, :version_file, :version_strategy, - :yum_archive_path, :yum_host, :yum_repo_path, :yum_repo_name, :yum_repo_command, ] @@ -172,14 +166,14 @@ Pkg::Config.config_from_hash(bad_params) end end end - mixed_params = { :sign_tar => true, :baz => 'qux' } + mixed_params = { :sign_tar => TRUE, :baz => 'qux' } context "given a hash with both valid and invalid params" do it "should set the valid param" do - Pkg::Config.should_receive(:instance_variable_set).with("@sign_tar", true) + Pkg::Config.should_receive(:instance_variable_set).with("@sign_tar", TRUE) Pkg::Config.config_from_hash(mixed_params) end it "should issue a warning that the invalid param is not valid" do Pkg::Config.should_receive(:warn).with(/No build data parameter found for 'baz'/) @@ -194,45 +188,47 @@ end describe "#params" do it "should return a hash containing keys for all build parameters" do params = Pkg::Config.config - Build_Params.each { |param| params.has_key?(param).should == true } + Build_Params.each { |param| params.has_key?(param).should == TRUE } end end describe "#platform_data" do platform_tags = [ - 'osx-10.15-x86_64', - 'osx-11-x86_64', + 'eos-4-i386', + 'osx-10.12-x86_64', + 'cisco-wrlinux-7-x86_64', 'ubuntu-16.04-i386', - 'el-6-x86_64', + 'cumulus-2.2-amd64', + 'el-6-s390x', 'el-7-ppc64le', 'sles-12-x86_64', ] artifacts = \ - "./artifacts/apple/10.15/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.15.dmg\n" \ - "./artifacts/apple/11/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx11.dmg\n" \ + "./artifacts/eos/4/PC1/i386/puppet-agent-5.3.2-1.eos4.i386.swix\n" \ + "./artifacts/apple/10.12/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.12.dmg\n" \ + "./artifacts/cisco-wrlinux/7/PC1/x86_64/puppet-agent-5.3.2-1.cisco_wrlinux7.x86_64.rpm\n" \ "./artifacts/deb/xenial/PC1/puppet-agent_5.3.2-1xenial_i386.deb\n" \ - "./artifacts/el/6/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.el6.x86_64.rpm\n" \ + "./artifacts/deb/cumulus/PC1/puppet-agent_5.3.2-1cumulus_amd64.deb\n" \ + "./artifacts/el/6/PC1/s390x/puppet-agent-5.3.2.658.gc79ef9a-1.el6.s390x.rpm\n" \ "./artifacts/el/7/PC1/ppc64le/puppet-agent-5.3.2-1.el7.ppc64le.rpm\n" \ "./artifacts/sles/12/PC1/x86_64/puppet-agent-5.3.2-1.sles12.x86_64.rpm" aix_artifacts = \ - "./artifacts/aix/7.1/PC1/ppc/puppet-agent-5.3.2-1.aix7.1.ppc.rpm" + "./artifacts/aix/6.1/PC1/ppc/puppet-agent-5.3.2-1.aix6.1.ppc.rpm" fedora_artifacts = \ - "./artifacts/fedora/31/PC1/x86_64/puppet-agent-5.3.2-1.fc31.x86_64.rpm" + "./artifacts/fedora/f25/PC1/x86_64/puppet-agent-5.3.2-1.fedoraf25.x86_64.rpm" windows_artifacts = \ "./artifacts/windows/puppet-agent-x64.msi\n" \ "./artifacts/windows/puppet-agent-5.3.2-x86.wixpdb\n" \ "./artifacts/windows/puppet-agent-5.3.2-x86.msi\n" \ - "./artifacts/windows/puppet-agent-5.3.2-x64.msi\n"\ - "./artifacts/windowsfips/puppet-agent-x64.msi\n" \ - "./artifacts/windowsfips/puppet-agent-5.3.2-x64.msi" + "./artifacts/windows/puppet-agent-5.3.2-x64.msi" solaris_artifacts = \ "./artifacts/solaris/11/PC1/puppet-agent@5.3.2,5.11-1.sparc.p5p\n" \ "./artifacts/solaris/10/PC1/puppet-agent-5.3.2-1.i386.pkg.gz" @@ -240,26 +236,21 @@ "./artifacts/deb/stretch/PC1/puppet-agent-dbgsym_5.3.2-1stretch_i386.deb\n" \ "./artifacts/deb/stretch/PC1/puppet-agent_5.3.2-1stretch_i386.deb\n" \ "./artifacts/deb/stretch/PC1/puppet-agent_5.3.2.658.gc79ef9a-1stretch_amd64.deb\n" \ "./artifacts/deb/stretch/PC1/puppet-agent-dbgsym_5.3.2.658.gc79ef9a-1stretch_amd64.deb" - artifacts_not_matching_project = \ - "./artifacts/deb/xenial/pe-postgresql-contrib_2019.1.9.6.12-1xenial_amd64.deb\n" \ - "./artifacts/deb/xenial/pe-postgresql-devel_2019.1.9.6.12-1xenial_amd64.deb\n" \ - "./artifacts/deb/xenial/pe-postgresql-server_2019.1.9.6.12-1xenial_amd64.deb\n" \ - "./artifacts/deb/xenial/pe-postgresql_2019.1.9.6.12-1xenial_amd64.deb" project = 'puppet-agent' ref = '5.3.2' before :each do allow(Pkg::Config).to receive(:project).and_return(project) allow(Pkg::Config).to receive(:ref).and_return(ref) allow(Pkg::Util::Net).to receive(:check_host_ssh).and_return([]) end it "should return a hash mapping platform tags to paths" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(artifacts, nil) + allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(artifacts, nil) expect(Pkg::Config.platform_data.keys).to eql(platform_tags) end it "should return nil if project isn't set" do allow(Pkg::Config).to receive(:project).and_return(nil) @@ -275,57 +266,46 @@ allow(Pkg::Util::Net).to receive(:check_host_ssh).and_return(['something']) expect(Pkg::Config.platform_data).to be_nil end it "should not use 'f' in fedora platform tags" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(fedora_artifacts, nil) + allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(fedora_artifacts, nil) data = Pkg::Config.platform_data - expect(data).to include('fedora-31-x86_64') - expect(data).not_to include('fedora-f31-x86_64') + expect(data).to include('fedora-25-x86_64') + expect(data).not_to include('fedora-f25-x86_64') end it "should collect packages whose extname differ from package_format" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(solaris_artifacts, nil) + allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(solaris_artifacts, nil) data = Pkg::Config.platform_data expect(data).to include('solaris-10-i386' => {:artifact => './solaris/10/PC1/puppet-agent-5.3.2-1.i386.pkg.gz', :repo_config => nil}) expect(data).to include('solaris-11-sparc' => {:artifact => './solaris/11/PC1/puppet-agent@5.3.2,5.11-1.sparc.p5p', :repo_config => nil}) end it "should collect versioned msis" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(windows_artifacts, nil) + allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(windows_artifacts, nil) data = Pkg::Config.platform_data expect(data['windows-2012-x86']).to include(:artifact => './windows/puppet-agent-5.3.2-x86.msi') expect(data['windows-2012-x64']).to include(:artifact => './windows/puppet-agent-5.3.2-x64.msi') - expect(data['windowsfips-2012-x64']).to include(:artifact => './windowsfips/puppet-agent-5.3.2-x64.msi') end it "should not collect debug packages" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(stretch_artifacts, nil) + allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(stretch_artifacts, nil) data = Pkg::Config.platform_data expect(data['debian-9-amd64']).to include(:artifact => './deb/stretch/PC1/puppet-agent_5.3.2.658.gc79ef9a-1stretch_amd64.deb') end - it "should collect packages that don't match the project name" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(artifacts_not_matching_project, nil) - data = Pkg::Config.platform_data - expect(data['ubuntu-16.04-amd64']).to include(:artifact => './deb/xenial/pe-postgresql-contrib_2019.1.9.6.12-1xenial_amd64.deb') - expect(data['ubuntu-16.04-amd64'][:additional_artifacts].size).to eq(3) - expect(data['ubuntu-16.04-amd64'][:additional_artifacts]).to include('./deb/xenial/pe-postgresql-devel_2019.1.9.6.12-1xenial_amd64.deb') - expect(data['ubuntu-16.04-amd64'][:additional_artifacts]).to include('./deb/xenial/pe-postgresql-server_2019.1.9.6.12-1xenial_amd64.deb') - expect(data['ubuntu-16.04-amd64'][:additional_artifacts]).to include('./deb/xenial/pe-postgresql_2019.1.9.6.12-1xenial_amd64.deb') - end - it "should use 'ppc' instead of 'power' in aix paths" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(aix_artifacts, nil) + allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(aix_artifacts, nil) data = Pkg::Config.platform_data - expect(data['aix-7.1-power']).to include(:artifact => './aix/7.1/PC1/ppc/puppet-agent-5.3.2-1.aix7.1.ppc.rpm') + expect(data['aix-6.1-power']).to include(:artifact => './aix/6.1/PC1/ppc/puppet-agent-5.3.2-1.aix6.1.ppc.rpm') end it "should not record an aix repo config" do - allow(Pkg::Util::Net).to receive(:remote_execute).and_return(aix_artifacts, nil) + allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(aix_artifacts, nil) data = Pkg::Config.platform_data - expect(data['aix-7.1-power'][:repo_config]).to be_nil + expect(data['aix-6.1-power'][:repo_config]).to be_nil end end describe "#config_to_yaml" do it "should write a valid yaml file" do @@ -354,10 +334,10 @@ context "given a yaml file" do it "should, use it to set params" do # apt_host: is set to "foo" in the fixture orig = Pkg::Config.apt_host Pkg::Config.apt_host = "bar" - Pkg::Config.config_from_yaml(File.join(FIXTURES, 'config', 'ext', 'build_defaults.yaml')) + Pkg::Config.config_from_yaml(File.join(FIXTURES, 'config', 'params.yaml')) expect(Pkg::Config.apt_host).to eq("foo") Pkg::Config.apt_host = orig end end end