diff --git a/testing-integration-py/resource_s3.py b/testing-integration-py/resource_s3.py index cf88ccaa5..92d8fe9ed 100644 --- a/testing-integration-py/resource_s3.py +++ b/testing-integration-py/resource_s3.py @@ -8,7 +8,7 @@ def create_s3_bucket(): # Create an AWS resource (S3 Bucket) - bucket = s3.Bucket(BUCKET_NAME) + bucket = s3.BucketV2(BUCKET_NAME) # Export the value of the bucket pulumi.export(OUTPUT_KEY_BUCKET_NAME, bucket.bucket) diff --git a/testing-unit-ts/mocha/bucket_pair.ts b/testing-unit-ts/mocha/bucket_pair.ts index 10cf2d75a..2629dcb09 100644 --- a/testing-unit-ts/mocha/bucket_pair.ts +++ b/testing-unit-ts/mocha/bucket_pair.ts @@ -3,17 +3,17 @@ import * as pulumi from "@pulumi/pulumi"; export class BucketPair extends pulumi.ComponentResource { - contentBucket: aws.s3.Bucket; - logsBucket: aws.s3.Bucket; + contentBucket: aws.s3.BucketV2; + logsBucket: aws.s3.BucketV2; constructor(contentBucketName: string, logsBucketName: string, opts: any) { super("pulumi:examples:BucketPair", "BucketPair", {}, opts); - this.contentBucket = new aws.s3.Bucket("contentBucket", { + this.contentBucket = new aws.s3.BucketV2("contentBucket", { bucket: contentBucketName, }, { parent: this }); - this.logsBucket = new aws.s3.Bucket("logsBucket", { + this.logsBucket = new aws.s3.BucketV2("logsBucket", { bucket: logsBucketName, }, { parent: this }); diff --git a/testing-unit-ts/mocha/bucket_pair_test.ts b/testing-unit-ts/mocha/bucket_pair_test.ts index be63ae2f4..4f95ab0fd 100644 --- a/testing-unit-ts/mocha/bucket_pair_test.ts +++ b/testing-unit-ts/mocha/bucket_pair_test.ts @@ -5,7 +5,7 @@ import "mocha"; import * as assert from 'assert'; pulumi.runtime.setMocks({ - newResource: function(args: pulumi.runtime.MockResourceArgs): {id: string, state: any} { + newResource: function (args: pulumi.runtime.MockResourceArgs): { id: string, state: any } { switch (args.type) { default: return { @@ -16,7 +16,7 @@ pulumi.runtime.setMocks({ }; } }, - call: function(args: pulumi.runtime.MockCallArgs) { + call: function (args: pulumi.runtime.MockCallArgs) { switch (args.token) { default: return args; @@ -24,32 +24,33 @@ pulumi.runtime.setMocks({ }, }); -describe("BucketPair", function() { +describe("BucketPair", function () { + this.timeout(10000); // Extend the timeout for this suite + let module: typeof import("./bucket_pair"); - before(async function() { + before(async function () { + this.timeout(10000); // Extend timeout for the import // It's important to import the program _after_ the mocks are defined. module = await import("./bucket_pair"); }); - describe("constructor", function() { - it("must pass bucket names", function(done) { + describe("constructor", function () { + it("must pass bucket names", function (done) { const bucketPair = new module.BucketPair('my_content_bucket', 'my_logs_bucket', {}); const outputs = [bucketPair.contentBucket.bucket, bucketPair.logsBucket.bucket]; + pulumi.all(outputs).apply(([contentBucketName, logsBucketName]) => { - try - { - /* - * If you don't have the try/catch in here, if the assert fails it'll just timeout - * If you have the try/catch, the "done()" in the catch block will get hit and it won't time out (async fun) - */ + try { + console.log("Testing outputs:", { contentBucketName, logsBucketName }); assert.strictEqual(contentBucketName, 'my_content_bucket'); assert.strictEqual(logsBucketName, 'my_logs_bucket'); done(); - } catch(e) { + } catch (e) { done(e); } }); }); }); }); +