Skip to content

Commit 8ed83f0

Browse files
authored
fix(e2e): delete cloudwatch groups in After call (#3951)
1 parent d07097b commit 8ed83f0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

features/cloudwatchlogs/cloudwatchlogs.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Feature:
88
Given I create a CloudWatch logGroup with prefix "aws-js-sdk"
99
And I list the CloudWatch logGroups
1010
Then the list should contain the CloudWatch logGroup
11-
And I delete the CloudWatch logGroup
1211

1312
Scenario: Error handling
1413
Given I create a CloudWatch logGroup with prefix ""

features/cloudwatchlogs/step_definitions/cloudwatchlogs.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
const { Before, Given, Then } = require("@cucumber/cucumber");
1+
const { Before, Given, Then, After } = require("@cucumber/cucumber");
22

3-
Before({ tags: "@cloudwatchlogs" }, function (scenario, callback) {
3+
Before({ tags: "@cloudwatchlogs" }, function () {
44
const { CloudWatchLogs } = require("../../../clients/client-cloudwatch-logs");
55
this.service = new CloudWatchLogs({});
6-
callback();
6+
});
7+
8+
After({ tags: "@cloudwatchlogs" }, async function () {
9+
if (this.logGroupName) {
10+
await this.service.deleteLogGroup({ logGroupName: this.logGroupName });
11+
}
712
});
813

914
Given("I create a CloudWatch logGroup with prefix {string}", function (prefix, callback) {
@@ -23,7 +28,3 @@ Then("the list should contain the CloudWatch logGroup", function (callback) {
2328
});
2429
callback();
2530
});
26-
27-
Then("I delete the CloudWatch logGroup", function (callback) {
28-
this.request(null, "deleteLogGroup", { logGroupName: this.logGroupName }, callback);
29-
});

0 commit comments

Comments
 (0)