Skip to content

Commit 86d6099

Browse files
committed
TearDownTestSuite: Allows us to re-run the test-suite multiple times
1 parent 8df4e9f commit 86d6099

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/s3_test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,24 @@ class S3 : public ::testing::Test {
2727

2828
return;
2929
}
30+
31+
static void TearDownTestSuite() {
32+
// Remove stale data that was created by the test-suite
33+
// so we can re-run the suite as many times as we want
34+
S3Client client = S3Client("minio_access", "minio_secret", "127.0.0.1:9000", S3AddressingStyle::PathStyle);
35+
36+
// This buckets *are* empty, therefore we won't trigger a paginator
37+
// if they fill in at some point in the future, this will throw error
38+
std::vector<std::string> BucketsToDelete {
39+
"test-bucket-s3cpp",
40+
"test-bucket-location",
41+
"test-bucket-tags"
42+
};
43+
for (const std::string& bName : BucketsToDelete) {
44+
auto res = client.DeleteBucket(bName);
45+
EXPECT_TRUE(res) << "Failed to delete bucket: " << res.error().Code;
46+
}
47+
}
3048
};
3149

3250
TEST_F(S3, ListObjectsBucket) {

0 commit comments

Comments
 (0)