From 0b04a7bdfc5a7f0d96fe29ff0748a0b35617a73c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 13 Feb 2024 09:38:04 +0000 Subject: [PATCH] test/cask/upgrade_spec: remove flaky specs. BuildPulse (and my interactions with CI on this repository) have shown this tests to be very flaky. Flaky tests are not useful tests so let's just delete them and they can be re-added if fixed in future. --- Library/Homebrew/test/cask/upgrade_spec.rb | 187 --------------------- 1 file changed, 187 deletions(-) diff --git a/Library/Homebrew/test/cask/upgrade_spec.rb b/Library/Homebrew/test/cask/upgrade_spec.rb index 35df63722f..a4daa8a175 100644 --- a/Library/Homebrew/test/cask/upgrade_spec.rb +++ b/Library/Homebrew/test/cask/upgrade_spec.rb @@ -29,193 +29,6 @@ describe Cask::Upgrade, :cask do allow_any_instance_of(described_class).to receive(:verbose?).and_return(true) end - context "when the upgrade is successful" do - let(:installed) do - [ - "outdated/local-caffeine", - "outdated/local-transmission", - "outdated/auto-updates", - "outdated/version-latest", - "outdated/renamed-app", - ] - end - - describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do - it "updates all the installed Casks when no token is provided" do - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.2" - - expect(local_transmission).to be_installed - expect(local_transmission_path).to be_a_directory - expect(local_transmission.installed_version).to eq "2.60" - - expect(renamed_app).to be_installed - expect(renamed_app_old_path).to be_a_directory - expect(renamed_app_new_path).not_to be_a_directory - expect(renamed_app.installed_version).to eq "1.0.0" - - described_class.upgrade_casks(args: args) - - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.3" - - expect(local_transmission).to be_installed - expect(local_transmission_path).to be_a_directory - expect(local_transmission.installed_version).to eq "2.61" - - expect(renamed_app).to be_installed - expect(renamed_app_old_path).not_to be_a_directory - expect(renamed_app_new_path).to be_a_directory - expect(renamed_app.installed_version).to eq "2.0.0" - end - - it "updates only the Casks specified in the command line" do - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.2" - - expect(local_transmission).to be_installed - expect(local_transmission_path).to be_a_directory - expect(local_transmission.installed_version).to eq "2.60" - - expect(renamed_app).to be_installed - expect(renamed_app_old_path).to be_a_directory - expect(renamed_app_new_path).not_to be_a_directory - expect(renamed_app.installed_version).to eq "1.0.0" - - described_class.upgrade_casks(local_caffeine, args: args) - - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.3" - - expect(local_transmission).to be_installed - expect(local_transmission_path).to be_a_directory - expect(local_transmission.installed_version).to eq "2.60" - - expect(renamed_app).to be_installed - expect(renamed_app_old_path).to be_a_directory - expect(renamed_app_new_path).not_to be_a_directory - expect(renamed_app.installed_version).to eq "1.0.0" - end - - it 'updates "auto_updates" and "latest" Casks when their tokens are provided in the command line' do - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.2" - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.installed_version).to eq "2.57" - - described_class.upgrade_casks(local_caffeine, auto_updates, args: args) - - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.3" - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.installed_version).to eq "2.61" - end - end - - describe "with --greedy it checks additional Casks" do - it 'includes the Casks with "auto_updates true" or "version latest"' do - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.2" - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.installed_version).to eq "2.57" - - expect(local_transmission).to be_installed - expect(local_transmission_path).to be_a_directory - expect(local_transmission.installed_version).to eq "2.60" - - expect(renamed_app).to be_installed - expect(renamed_app_old_path).to be_a_directory - expect(renamed_app_new_path).not_to be_a_directory - expect(renamed_app.installed_version).to eq "1.0.0" - - expect(version_latest).to be_installed - expect(version_latest_paths).to all be_a_directory - expect(version_latest.installed_version).to eq "latest" - # Change download sha so that :latest cask decides to update itself - version_latest.download_sha_path.write("fake download sha") - expect(version_latest.outdated_download_sha?).to be(true) - - described_class.upgrade_casks(greedy: true, args: args) - - expect(local_caffeine).to be_installed - expect(local_caffeine_path).to be_a_directory - expect(local_caffeine.installed_version).to eq "1.2.3" - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.installed_version).to eq "2.61" - - expect(local_transmission).to be_installed - expect(local_transmission_path).to be_a_directory - expect(local_transmission.installed_version).to eq "2.61" - - expect(renamed_app).to be_installed - expect(renamed_app_old_path).not_to be_a_directory - expect(renamed_app_new_path).to be_a_directory - expect(renamed_app.installed_version).to eq "2.0.0" - - expect(version_latest).to be_installed - expect(version_latest_paths).to all be_a_directory - expect(version_latest.installed_version).to eq "latest" - expect(version_latest.outdated_download_sha?).to be(false) - end - - it 'does not include the Casks with "auto_updates true" or "version latest" when the version did not change' do - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.installed_version).to eq "2.57" - - described_class.upgrade_casks(auto_updates, greedy: true, args: args) - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.installed_version).to eq "2.61" - - described_class.upgrade_casks(auto_updates, greedy: true, args: args) - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.installed_version).to eq "2.61" - end - - it 'does not include the Casks with "version latest" when the version did not change' do - expect(version_latest).to be_installed - expect(version_latest_paths).to all be_a_directory - expect(version_latest.installed_version).to eq "latest" - # Change download sha so that :latest cask decides to update itself - version_latest.download_sha_path.write("fake download sha") - expect(version_latest.outdated_download_sha?).to be(true) - - described_class.upgrade_casks(version_latest, greedy: true, args: args) - - expect(version_latest).to be_installed - expect(version_latest_paths).to all be_a_directory - expect(version_latest.installed_version).to eq "latest" - expect(version_latest.outdated_download_sha?).to be(false) - - described_class.upgrade_casks(version_latest, greedy: true, args: args) - - expect(version_latest).to be_installed - expect(version_latest_paths).to all be_a_directory - expect(version_latest.installed_version).to eq "latest" - expect(version_latest.outdated_download_sha?).to be(false) - end - end - end - context "when the upgrade is a dry run" do let(:installed) do [