10000 Skip tests on "429 Too Many Requests" response by zonuexe · Pull Request #631 · cweagans/composer-patches · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Skip tests on "429 Too Many Requests" response #631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/unit/ComposerDownloaderTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Codeception\Util\Stub;
use Composer\Composer;
use Composer\Config;
use Composer\Downloader\TransportException;
use Composer\IO\NullIO;
use Composer\Plugin\PluginInterface;
use cweagans\Composer\Downloader\ComposerDownloader;
Expand Down Expand Up @@ -66,7 +67,15 @@ public function testDownloader()
$patch->localPath = '';
$patch->sha256 = 'an incorrect hash';
$this->expectException(HashMismatchException::class);
$downloader->download($patch);
try {
$downloader->download($patch);
} catch (TransportException $e) {
// Check for a "429 Too Many Requests" response, often due to rate limiting,
// and skip the test if encountered.
if ($this->getStatusCode() === 429) {
$this->makeTestSkipped($e->getMessage());
}
}
}

/**
Expand Down
0