Skip to content

Commit

Permalink
Add hint for SABRE_HTTP_TEST_GET_LARGE_CONTENT_MAX_PEAK_MEMORY_USAGE …
Browse files Browse the repository at this point in the history
…env var in test
  • Loading branch information
phil-davis committed Jul 15, 2022
1 parent d49ca7a commit 94321c1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/HTTP/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ public function testSendToGetLargeContent()

// Allow the peak memory usage limit to be specified externally, if needed.
// When running this test in different environments it may be appropriate to set a different limit.
$maxPeakMemoryUsage = \getenv('SABRE_HTTP_TEST_GET_LARGE_CONTENT_MAX_PEAK_MEMORY_USAGE');
$maxPeakMemoryUsageEnvVariable = 'SABRE_HTTP_TEST_GET_LARGE_CONTENT_MAX_PEAK_MEMORY_USAGE';
$maxPeakMemoryUsage = \getenv($maxPeakMemoryUsageEnvVariable);
if (false === $maxPeakMemoryUsage) {
$maxPeakMemoryUsage = 60 * pow(1024, 2);
}
Expand All @@ -221,7 +222,11 @@ public function testSendToGetLargeContent()
$response = $client->send($request);

$this->assertEquals(200, $response->getStatus());
$this->assertLessThan((int) $maxPeakMemoryUsage, memory_get_peak_usage());
$this->assertLessThan(
(int) $maxPeakMemoryUsage,
memory_get_peak_usage(),
"Hint: you can adjust the max peak memory usage allowed for this test by defining env variable $maxPeakMemoryUsageEnvVariable to be the desired max bytes"
);
}

/**
Expand Down

0 comments on commit 94321c1

Please sign in to comment.