OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
zzXpress
/
vendor
/
aws
/
aws-sdk-php
/
tests
/
EndpointDiscovery
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
ConfigurationProviderTest.php
17.07 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
ConfigurationTest.php
1.11 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
EndpointDiscoveryMiddlewareTest.php
42.46 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
EndpointListTest.php
2.45 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
fixtures
-
11/13/2024 03:03:46 PM
rwxr-xr-x
Editing: EndpointListTest.php
Close
<?php namespace Aws\Test\EndpointDiscovery; use Aws\EndpointDiscovery\EndpointList; use PHPUnit\Framework\TestCase; /** * @covers \Aws\EndpointDiscovery\EndpointList */ class EndpointListTest extends TestCase { public function testStoresRetrievesAndCyclesActiveEndpoints() { $list = new EndpointList([ 'endpoint_1' => time() + 100, 'endpoint_2' => time() + 100, ]); $this->assertSame('endpoint_1', $list->getActive()); $this->assertSame('endpoint_2', $list->getActive()); $this->assertSame('endpoint_1', $list->getActive()); $this->assertSame('endpoint_2', $list->getActive()); } public function testMovesToAndRetrievesFromExpiredEndpoints() { $list = new EndpointList([ 'endpoint_1' => time() + 2, 'endpoint_2' => time() + 2, ]); $this->assertSame('endpoint_1', $list->getActive()); $this->assertSame('endpoint_2', $list->getActive()); sleep(4); $this->assertNull($list->getActive()); $this->assertSame('endpoint_1', $list->getEndpoint()); $this->assertSame('endpoint_2', $list->getEndpoint()); $this->assertSame('endpoint_1', $list->getEndpoint()); $this->assertSame('endpoint_2', $list->getEndpoint()); } public function testGetEndpointSelectsActiveThenExpired() { $list = new EndpointList([ 'endpoint_1' => time() - 100, 'endpoint_2' => time() + 100, ]); $this->assertSame('endpoint_2', $list->getEndpoint()); // Make sure list is not cycling to the expired endpoint $this->assertSame('endpoint_2', $list->getEndpoint()); $list->remove('endpoint_2'); $this->assertSame('endpoint_1', $list->getEndpoint()); } public function testRemovesEndpoints() { $list = new EndpointList([ 'endpoint_1' => time() - 100, 'endpoint_2' => time() + 100, ]); $this->assertSame('endpoint_2', $list->getActive()); $list->remove('endpoint_2'); $this->assertNull($list->getActive()); $this->assertSame('endpoint_1', $list->getEndpoint()); // Check that 'endpoint_2' was not moved to the expired list $this->assertSame('endpoint_1', $list->getEndpoint()); $list->remove('endpoint_1'); $this->assertNull($list->getEndpoint()); } }