From 4ce4bf0ddc0dda1a4563c2dac42b20cc40efbc73 Mon Sep 17 00:00:00 2001 From: Yenfry Herrera Feliz Date: Wed, 9 Oct 2024 15:33:54 -0400 Subject: [PATCH] chore: skip SubscriptionRequired exceptions (#3012) --- .../marketplacecommerceanalytics.feature | 2 +- tests/Integ/SmokeContext.php | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/features/smoke/marketplacecommerceanalytics.feature b/features/smoke/marketplacecommerceanalytics.feature index 0b1ae70100..51b3e5a22a 100644 --- a/features/smoke/marketplacecommerceanalytics.feature +++ b/features/smoke/marketplacecommerceanalytics.feature @@ -9,4 +9,4 @@ Feature: AWS Marketplace Commerce Analytics | roleNameArn | fake-arn | | destinationS3BucketName | fake-bucket | | snsTopicArn | fake-arn | - Then I expect the response error code to be "SerializationException" + Then I expect the marketplace commerce analytics response error code to be "SerializationException" diff --git a/tests/Integ/SmokeContext.php b/tests/Integ/SmokeContext.php index c8f190bea5..e23a6203a6 100644 --- a/tests/Integ/SmokeContext.php +++ b/tests/Integ/SmokeContext.php @@ -182,15 +182,7 @@ public static function setUpMarketplaceCommerceAnalytics(BeforeFeatureScope $sco 'destinationS3BucketName' => 'fake-bucket', 'snsTopicArn' => 'fake-arn', ]); - } catch (\Exception $e) { - // If the test failed because the account has no support subscription, - // throw the exception to cause the feature to be skipped. - if ($e instanceof AwsException - && 'SubscriptionRequiredException' === $e->getAwsErrorCode() - ) { - throw $e; - } - } + } catch (\Exception $e) {} } /** @@ -366,6 +358,22 @@ public function iExpectTheResponseErrorCodeToBe($errorCode) $this->assertSame($errorCode, $this->error->getAwsErrorCode()); } + /** + * @Then I expect the marketplace commerce analytics response error code to be :errorCode + * + * @param string $errorCode + */ + public function iExpectTheMarketplaceCommerceAnalyticsErrorCodeToBe($errorCode) + { + if ($this->error->getAwsErrorCode() === 'SubscriptionRequiredException') { + // For skipping subscription required exceptions + $this->assertTrue(true); + return; + } + + $this->assertSame($errorCode, $this->error->getAwsErrorCode()); + } + /** * @Then I expect the response error message to include: *