Skip to content

Commit beeac20

Browse files
authored
Converting to BucketV2, fixes #1716 (#1769)
1 parent 42188fc commit beeac20

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

testing-integration-py/resource_s3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
def create_s3_bucket():
1010
# Create an AWS resource (S3 Bucket)
11-
bucket = s3.Bucket(BUCKET_NAME)
11+
bucket = s3.BucketV2(BUCKET_NAME)
1212

1313
# Export the value of the bucket
1414
pulumi.export(OUTPUT_KEY_BUCKET_NAME, bucket.bucket)

testing-unit-ts/mocha/bucket_pair.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import * as pulumi from "@pulumi/pulumi";
33

44
export class BucketPair extends pulumi.ComponentResource {
55

6-
contentBucket: aws.s3.Bucket;
7-
logsBucket: aws.s3.Bucket;
6+
contentBucket: aws.s3.BucketV2;
7+
logsBucket: aws.s3.BucketV2;
88

99
constructor(contentBucketName: string, logsBucketName: string, opts: any) {
1010
super("pulumi:examples:BucketPair", "BucketPair", {}, opts);
1111

12-
this.contentBucket = new aws.s3.Bucket("contentBucket", {
12+
this.contentBucket = new aws.s3.BucketV2("contentBucket", {
1313
bucket: contentBucketName,
1414
}, { parent: this });
1515

16-
this.logsBucket = new aws.s3.Bucket("logsBucket", {
16+
this.logsBucket = new aws.s3.BucketV2("logsBucket", {
1717
bucket: logsBucketName,
1818
}, { parent: this });
1919

testing-unit-ts/mocha/bucket_pair_test.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "mocha";
55
import * as assert from 'assert';
66

77
pulumi.runtime.setMocks({
8-
newResource: function(args: pulumi.runtime.MockResourceArgs): {id: string, state: any} {
8+
newResource: function (args: pulumi.runtime.MockResourceArgs): { id: string, state: any } {
99
switch (args.type) {
1010
default:
1111
return {
@@ -16,40 +16,41 @@ pulumi.runtime.setMocks({
1616
};
1717
}
1818
},
19-
call: function(args: pulumi.runtime.MockCallArgs) {
19+
call: function (args: pulumi.runtime.MockCallArgs) {
2020
switch (args.token) {
2121
default:
2222
return args;
2323
}
2424
},
2525
});
2626

27-
describe("BucketPair", function() {
27+
describe("BucketPair", function () {
28+
this.timeout(10000); // Extend the timeout for this suite
29+
2830
let module: typeof import("./bucket_pair");
2931

30-
before(async function() {
32+
before(async function () {
33+
this.timeout(10000); // Extend timeout for the import
3134
// It's important to import the program _after_ the mocks are defined.
3235
module = await import("./bucket_pair");
3336
});
3437

35-
describe("constructor", function() {
36-
it("must pass bucket names", function(done) {
38+
describe("constructor", function () {
39+
it("must pass bucket names", function (done) {
3740
const bucketPair = new module.BucketPair('my_content_bucket', 'my_logs_bucket', {});
3841
const outputs = [bucketPair.contentBucket.bucket, bucketPair.logsBucket.bucket];
42+
3943
pulumi.all(outputs).apply(([contentBucketName, logsBucketName]) => {
40-
try
41-
{
42-
/*
43-
* If you don't have the try/catch in here, if the assert fails it'll just timeout
44-
* If you have the try/catch, the "done()" in the catch block will get hit and it won't time out (async fun)
45-
*/
44+
try {
45+
console.log("Testing outputs:", { contentBucketName, logsBucketName });
4646
assert.strictEqual(contentBucketName, 'my_content_bucket');
4747
assert.strictEqual(logsBucketName, 'my_logs_bucket');
4848
done();
49-
} catch(e) {
49+
} catch (e) {
5050
done(e);
5151
}
5252
});
5353
});
5454
});
5555
});
56+

0 commit comments

Comments
 (0)