Skip to content

Commit

Permalink
Allow testSendToGetLargeContent peak memory usage to be specified ext…
Browse files Browse the repository at this point in the history
…ernally
  • Loading branch information
phil-davis committed Jul 15, 2022
1 parent 87fbcab commit d49ca7a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/HTTP/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,19 @@ public function testSendToGetLargeContent()
$this->markTestSkipped('Set an environment value BASEURL to continue');
}

// 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');
if (false === $maxPeakMemoryUsage) {
$maxPeakMemoryUsage = 60 * pow(1024, 2);
}

$request = new Request('GET', $url);
$client = new Client();
$response = $client->send($request);

$this->assertEquals(200, $response->getStatus());
$this->assertLessThan(60 * pow(1024, 2), memory_get_peak_usage());
$this->assertLessThan((int) $maxPeakMemoryUsage, memory_get_peak_usage());
}

/**
Expand Down

0 comments on commit d49ca7a

Please sign in to comment.