From e8d27ec8ccaee6e34e7f8cda16d70dccca3a1308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 2 Mar 2022 18:12:07 +0100 Subject: [PATCH] Selectively disable acceptance tests. --- rubygem-webmock.spec | 64 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/rubygem-webmock.spec b/rubygem-webmock.spec index 4919f9a..9356c48 100644 --- a/rubygem-webmock.spec +++ b/rubygem-webmock.spec @@ -1,6 +1,18 @@ # Generated from webmock-1.7.6.gem by gem2rpm -*- rpm-spec -*- %global gem_name webmock +# Disable HTTP clients integration tests we don't have in Fedora. +%bcond_with async_http_client +%bcond_without curb +%bcond_without em_http_request +%bcond_without excon +%bcond_with http_rb +%bcond_without httpclient +%bcond_with manticore +%bcond_without net_http +%bcond_with patron +%bcond_without typhoeus + Name: rubygem-%{gem_name} Version: 3.11.1 Release: 5%{?dist} @@ -17,17 +29,22 @@ BuildRequires: rubygems-devel BuildRequires: ruby BuildRequires: rubygem(addressable) BuildRequires: rubygem(crack) -BuildRequires: rubygem(curb) -BuildRequires: rubygem(excon) -BuildRequires: rubygem(em-http-request) BuildRequires: rubygem(hashdiff) -BuildRequires: rubygem(httpclient) BuildRequires: rubygem(minitest) BuildRequires: rubygem(rack) BuildRequires: rubygem(rspec) BuildRequires: rubygem(test-unit) -BuildRequires: rubygem(typhoeus) BuildRequires: rubygem(webrick) + +%{?with_async_http_client:BuildRequires: rubygem(async_http_client)} +%{?with_curb:BuildRequires: rubygem(curb)} +%{?with_em_http_request:BuildRequires: rubygem(em-http-request)} +%{?with_excon:BuildRequires: rubygem(excon)} +%{?with_http_rb:BuildRequires: rubygem(http_rb)} +%{?with_httpclient:BuildRequires: rubygem(httpclient)} +%{?with_manticore:BuildRequires: rubygem(manticore)} +%{?with_patron:BuildRequires: rubygem(patron)} +%{?with_typhoeus:BuildRequires: rubygem(typhoeus)} BuildArch: noarch %description @@ -63,11 +80,41 @@ pushd .%{gem_instdir} ruby -e 'Dir.glob "./minitest/**/*.rb", &method(:require)' ruby -e 'Dir.glob "./test/**/test_*.rb", &method(:require)' -# rubygem-{async-http,patron,http} are not in Fedora yet. -sed -i '/patron/ s/^/#/' spec/spec_helper.rb +# Create list of dependencies to ignore based on bcond flags. +ignore_list=( +%{with_async_http_client} +%{with_curb} +%{with_em_http_request} +%{with_excon} +%{with_http_rb} +%{with_httpclient} +%{with_manticore} +%{with_net_http} +%{with_patron} +%{with_typhoeus} +) +ignore_list=($(echo ${ignore_list[*]} | \ + sed 's/1//g' | \ + sed -r 's/%\{with_([^{]*)\}/\1/g' +)) + +# Remove unavailable dependencies based on ignore_list. +for i in ${ignore_list[*]}; do + sed -i "/$i/ s/^/#/" spec/spec_helper.rb +done # and we don't care about code quality, that's upstream business. -rspec spec --exclude-pattern 'spec/{quality_spec.rb,acceptance/{async_http_client,patron,http_rb}/*}' +rspec spec --exclude-pattern 'spec/{quality_spec.rb,acceptance/**/*}' + +# Run acceptance test for each http client independently. +for t in spec/acceptance/*/; do + acceptance_test=$(basename ${t}) + if [[ " ${ignore_list[*]} " =~ " ${acceptance_test} " ]]; then + echo "* ${acceptance_test} acceptance test ignored due to missing dependency" + continue + fi + rspec ${t} +done popd @@ -93,6 +140,7 @@ popd %changelog * Tue Mar 01 2022 Vít Ondruch - 3.11.1-5 - Fix FTBFS caused by latest RSpec. +- Selectively disable acceptance tests. * Fri Jan 21 2022 Fedora Release Engineering - 3.11.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild