Skip to content
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

fix(test runs): don't count against exempt host #2686

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion www/runtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,10 @@ function LogTest(&$test, $testId, $url)
server_sync($apiKey, $runcount, null);
return;
}
$runcount = Util::getRunCount($test['runs'], $test['fvonly'], $test['lighthouse'], $test['type']);

$host = parse_url($url, PHP_URL_HOST);
$exempt_host = parse_url(Util::getExemptHost(), PHP_URL_HOST);
$runcount = ($host == $exempt_host) ? 0 : Util::getRunCount($test['runs'], $test['fvonly'], $test['lighthouse'], $test['type']);

if (!is_dir('./logs')) {
mkdir('./logs', 0777, true);
Expand Down
4 changes: 2 additions & 2 deletions www/src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,9 @@ public static function getRunCount($runs, $fvonly, $lighthouse, $testtype): int
/**
* This is used to determine which hosts don't get counted in test runs
*/
public static function getExemptHost(): string
public static function getExemptHost(?string $default = ""): string
{
return 'webpagetest.org';
return self::getSetting('exempt_from_test_run_count_host', $default);
}

/**
Expand Down