From 8d123d1bef060f213df9d3d938551cac949450cb Mon Sep 17 00:00:00 2001 From: SamRemis Date: Wed, 12 Jul 2023 13:28:27 -0400 Subject: [PATCH 1/2] Update CrtContext.php --- tests/Integ/CrtContext.php | 42 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/tests/Integ/CrtContext.php b/tests/Integ/CrtContext.php index e7a4268366..db8e9e6f92 100644 --- a/tests/Integ/CrtContext.php +++ b/tests/Integ/CrtContext.php @@ -123,24 +123,34 @@ public static function createGlobalEndpoint() 'region' => 'us-east-1', 'version' => 'latest' ]); - - $result = $eventBridgeClient->createEndpoint([ - 'Name' => 'test-endpoint', - 'EventBuses' => self::$eventBuses, - 'ReplicationConfig' => [ - 'State' => 'DISABLED' - ], - 'RoutingConfig' => [ - 'FailoverConfig' => [ - 'Primary' => [ - 'HealthCheck' => self::$healthCheckArn - ], - 'Secondary' => [ - 'Route' => 'us-west-2' + $currentEndpoints = $eventBridgeClient->listEndpoints(); + $testEndpointExists = false; + foreach ($currentEndpoints as $endpoint) { + if ($endpoint['Name'] == 'test-endpoint') { + $testEndpointExists = true; + break; + } + } + if (!$testEndpointExists) { + $eventBridgeClient->createEndpoint([ + 'Name' => 'test-endpoint', + 'EventBuses' => self::$eventBuses, + 'ReplicationConfig' => [ + 'State' => 'DISABLED' + ], + 'RoutingConfig' => [ + 'FailoverConfig' => [ + 'Primary' => [ + 'HealthCheck' => self::$healthCheckArn + ], + 'Secondary' => [ + 'Route' => 'us-west-2' + ] ] ] - ] - ]); + ]); + } + $attempts = 0; $active = false; $result = null; From 8eb77ef185622c3db5761a9ddfc75a61763c3e68 Mon Sep 17 00:00:00 2001 From: SamRemis Date: Wed, 12 Jul 2023 13:32:56 -0400 Subject: [PATCH 2/2] Update CrtContext.php --- tests/Integ/CrtContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Integ/CrtContext.php b/tests/Integ/CrtContext.php index db8e9e6f92..5c75839a2c 100644 --- a/tests/Integ/CrtContext.php +++ b/tests/Integ/CrtContext.php @@ -125,7 +125,7 @@ public static function createGlobalEndpoint() ]); $currentEndpoints = $eventBridgeClient->listEndpoints(); $testEndpointExists = false; - foreach ($currentEndpoints as $endpoint) { + foreach ($currentEndpoints['Endpoints'] as $endpoint) { if ($endpoint['Name'] == 'test-endpoint') { $testEndpointExists = true; break;