diff --git a/Makefile b/Makefile index c5aa90352703..57a114c052e4 100644 --- a/Makefile +++ b/Makefile @@ -33,22 +33,24 @@ ensure: .ensure.phony go.ensure $(SUB_PROJECTS:%=%_ensure) @touch .ensure.phony .PHONY: build-proto -PROTO_FILES := $(sort $(shell find proto/ -type f -name '*.proto') proto/generate.sh proto/build-container/Dockerfile $(wildcard proto/build-container/scripts/*)) +PROTO_FILES := $(sort $(shell find proto -type f -name '*.proto') proto/generate.sh proto/build-container/Dockerfile $(wildcard proto/build-container/scripts/*)) +PROTO_CKSUM = cksum ${PROTO_FILES} | sort --key=3 build-proto: @printf "Protobuffer interfaces are ....... " - @if [ "$$(cat proto/.checksum.txt)" = "$$(cksum $(PROTO_FILES))" ]; then \ + @if [ "$$(cat proto/.checksum.txt)" = "`${PROTO_CKSUM}`" ]; then \ printf "\033[0;32mup to date\033[0m\n"; \ else \ printf "\033[0;34mout of date: REBUILDING\033[0m\n"; \ cd proto && ./generate.sh || exit 1; \ - cd ../ && cksum $(PROTO_FILES) > proto/.checksum.txt; \ + cd ../ && ${PROTO_CKSUM} > proto/.checksum.txt; \ printf "\033[0;34mProtobuffer interfaces have been \033[0;32mREBUILT\033[0m\n"; \ fi .PHONY: check-proto check-proto: - @if [ "$$(cat proto/.checksum.txt)" != "$$(cksum $(PROTO_FILES))" ]; then \ + @if [ "$$(cat proto/.checksum.txt)" != "`${PROTO_CKSUM}`" ]; then \ echo "Protobuff checksum doesn't match. Run \`make build-proto\` to rebuild."; \ + ${PROTO_CKSUM} | diff - proto/.checksum.txt; \ exit 1; \ fi diff --git a/sdk/nodejs/tests/automation/cmd.spec.ts b/sdk/nodejs/tests/automation/cmd.spec.ts index 98c457a46448..d451610976dc 100644 --- a/sdk/nodejs/tests/automation/cmd.spec.ts +++ b/sdk/nodejs/tests/automation/cmd.spec.ts @@ -14,10 +14,9 @@ import * as assert from "assert"; import { runPulumiCmd } from "../../automation"; -import { asyncTest } from "../util"; describe("automation/cmd", () => { - it("calls onOutput when provided to runPulumiCmd", asyncTest(async () => { + it("calls onOutput when provided to runPulumiCmd", async () => { let output = ""; let numCalls = 0; await runPulumiCmd(["--help"], ".", {}, (data: string) => { @@ -27,5 +26,5 @@ describe("automation/cmd", () => { assert.ok(numCalls > 0, `expected numCalls > 0, got ${numCalls}`); assert.match(output, new RegExp("Usage[:]")); assert.match(output, new RegExp("[-][-]verbose")); - })); + }); }); diff --git a/sdk/nodejs/tests/automation/localWorkspace.spec.ts b/sdk/nodejs/tests/automation/localWorkspace.spec.ts index d835c47b42cb..8fbc20fe1589 100644 --- a/sdk/nodejs/tests/automation/localWorkspace.spec.ts +++ b/sdk/nodejs/tests/automation/localWorkspace.spec.ts @@ -27,14 +27,13 @@ import { parseAndValidatePulumiVersion, } from "../../automation"; import { Config, output } from "../../index"; -import { asyncTest } from "../util"; import { getTestOrg, getTestSuffix } from "./util"; const versionRegex = /(\d+\.)(\d+\.)(\d+)(-.*)?/; const userAgent = "pulumi/pulumi/test"; describe("LocalWorkspace", () => { - it(`projectSettings from yaml/yml/json`, asyncTest(async () => { + it(`projectSettings from yaml/yml/json`, async () => { for (const ext of ["yaml", "yml", "json"]) { const ws = await LocalWorkspace.create({ workDir: upath.joinSafe(__dirname, "data", ext) }); const settings = await ws.projectSettings(); @@ -43,9 +42,9 @@ describe("LocalWorkspace", () => { assert(settings.description, "A minimal Go Pulumi program"); } - })); + }); - it(`stackSettings from yaml/yml/json`, asyncTest(async () => { + it(`stackSettings from yaml/yml/json`, async () => { for (const ext of ["yaml", "yml", "json"]) { const ws = await LocalWorkspace.create({ workDir: upath.joinSafe(__dirname, "data", ext) }); const settings = await ws.stackSettings("dev"); @@ -53,18 +52,18 @@ describe("LocalWorkspace", () => { assert.strictEqual(settings.config!["plain"], "plain"); assert.strictEqual(settings.config!["secure"].secure, "secret"); } - })); + }); - it(`adds/removes/lists plugins successfully`, asyncTest(async () => { + it(`adds/removes/lists plugins successfully`, async () => { const ws = await LocalWorkspace.create({}); await ws.installPlugin("aws", "v3.0.0"); // See https://github.com/pulumi/pulumi/issues/11013 for why this is disabled //await ws.installPluginFromServer("scaleway", "v1.2.0", "github://api.github.com/lbrlabs"); await ws.removePlugin("aws", "3.0.0"); await ws.listPlugins(); - })); + }); - it(`create/select/remove LocalWorkspace stack`, asyncTest(async () => { + it(`create/select/remove LocalWorkspace stack`, async () => { const projectName = "node_test"; const projectSettings: ProjectSettings = { name: projectName, @@ -75,9 +74,9 @@ describe("LocalWorkspace", () => { await ws.createStack(stackName); await ws.selectStack(stackName); await ws.removeStack(stackName); - })); + }); - it(`create/select/createOrSelect Stack`, asyncTest(async () => { + it(`create/select/createOrSelect Stack`, async () => { const projectName = "node_test"; const projectSettings: ProjectSettings = { name: projectName, @@ -89,8 +88,8 @@ describe("LocalWorkspace", () => { await Stack.select(stackName, ws); await Stack.createOrSelect(stackName, ws); await ws.removeStack(stackName); - })); - it(`Config`, asyncTest(async () => { + }); + it(`Config`, async () => { const projectName = "node_test"; const projectSettings: ProjectSettings = { name: projectName, @@ -133,8 +132,8 @@ describe("LocalWorkspace", () => { assert.strictEqual(Object.keys(values).length, 2, "expected stack config to have 2 values"); await ws.removeStack(stackName); - })); - it(`config_flag_like`, asyncTest(async () => { + }); + it(`config_flag_like`, async () => { const projectName = "config_flag_like"; const projectSettings: ProjectSettings = { name: projectName, @@ -159,8 +158,8 @@ describe("LocalWorkspace", () => { assert.strictEqual(values2["config_flag_like:key"].secret, false); assert.strictEqual(values2["config_flag_like:secret-key"].value, "-value2"); assert.strictEqual(values2["config_flag_like:secret-key"].secret, true); - })); - it(`nested_config`, asyncTest(async () => { + }); + it(`nested_config`, async () => { if (getTestOrg() !== "pulumi-test") { return; } @@ -184,8 +183,8 @@ describe("LocalWorkspace", () => { const list = await stack.getConfig("myList"); assert.strictEqual(list.secret, false); assert.strictEqual(list.value, "[\"one\",\"two\",\"three\"]"); - })); - it(`can list stacks and currently selected stack`, asyncTest(async () => { + }); + it(`can list stacks and currently selected stack`, async () => { const projectName = `node_list_test${getTestSuffix()}`; const projectSettings: ProjectSettings = { name: projectName, @@ -207,8 +206,8 @@ describe("LocalWorkspace", () => { for (const name of stackNames) { await ws.removeStack(name); } - })); - it(`stack status methods`, asyncTest(async () => { + }); + it(`stack status methods`, async () => { const projectName = "node_test"; const projectSettings: ProjectSettings = { name: projectName, @@ -222,9 +221,9 @@ describe("LocalWorkspace", () => { const info = await stack.info(); assert.strictEqual(typeof (info), "undefined"); await ws.removeStack(stackName); - })); + }); // TODO[pulumi/pulumi#8220] understand why this test was flaky - xit(`runs through the stack lifecycle with a local program`, asyncTest(async () => { + xit(`runs through the stack lifecycle with a local program`, async () => { const stackName = fullyQualifiedStackName(getTestOrg(), "testproj", `int_test${getTestSuffix()}`); const workDir = upath.joinSafe(__dirname, "data", "testproj"); const stack = await LocalWorkspace.createStack({ stackName, workDir }); @@ -262,8 +261,8 @@ describe("LocalWorkspace", () => { assert.strictEqual(destroyRes.summary.result, "succeeded"); await stack.workspace.removeStack(stackName); - })); - it(`runs through the stack lifecycle with an inline program`, asyncTest(async () => { + }); + it(`runs through the stack lifecycle with an inline program`, async () => { const program = async () => { const config = new Config(); return { @@ -309,8 +308,8 @@ describe("LocalWorkspace", () => { assert.strictEqual(destroyRes.summary.result, "succeeded"); await stack.workspace.removeStack(stackName); - })); - it(`successfully initializes multiple stacks`, asyncTest(async () => { + }); + it(`successfully initializes multiple stacks`, async () => { const program = async () => { const config = new Config(); return { @@ -323,8 +322,8 @@ describe("LocalWorkspace", () => { const stackNames = Array.from(Array(10).keys()).map(_ => fullyQualifiedStackName(getTestOrg(), projectName, `int_test${getTestSuffix()}`)); const stacks = await Promise.all(stackNames.map(async stackName => LocalWorkspace.createStack({ stackName, projectName, program }))); await stacks.map(stack => stack.workspace.removeStack(stack.name)); - })); - it(`runs through the stack lifecycle with multiple inline programs in parallel`, asyncTest(async () => { + }); + it(`runs through the stack lifecycle with multiple inline programs in parallel`, async () => { const program = async () => { const config = new Config(); return { @@ -375,8 +374,8 @@ describe("LocalWorkspace", () => { }; await Promise.all(stackNames.map(async stackName => await testStackLifetime(stackName))); - })); - it(`handles events`, asyncTest(async () => { + }); + it(`handles events`, async () => { const program = async () => { const config = new Config(); return { @@ -435,10 +434,10 @@ describe("LocalWorkspace", () => { assert.strictEqual(destroyRes.summary.result, "succeeded"); await stack.workspace.removeStack(stackName); - })); + }); // TODO[pulumi/pulumi#7127]: Re-enabled the warning. // Temporarily skipping test until we've re-enabled the warning. - it.skip(`has secret config warnings`, asyncTest(async () => { + it.skip(`has secret config warnings`, async () => { const program = async () => { const config = new Config(); @@ -597,8 +596,8 @@ describe("LocalWorkspace", () => { validate(events); await stack.workspace.removeStack(stackName); - })); - it(`imports and exports stacks`, asyncTest(async () => { + }); + it(`imports and exports stacks`, async () => { const program = async () => { const config = new Config(); return { @@ -631,9 +630,9 @@ describe("LocalWorkspace", () => { assert.strictEqual(destroyRes.summary.result, "succeeded"); await stack.workspace.removeStack(stackName); } - })); + }); // TODO[pulumi/pulumi#8061] flaky test - xit(`supports stack outputs`, asyncTest(async () => { + xit(`supports stack outputs`, async () => { const program = async () => { const config = new Config(); return { @@ -683,8 +682,8 @@ describe("LocalWorkspace", () => { } finally { await stack.workspace.removeStack(stackName); } - })); - it(`runs an inline program that rejects a promise and exits gracefully`, asyncTest(async () => { + }); + it(`runs an inline program that rejects a promise and exits gracefully`, async () => { const program = async () => { Promise.reject(new Error()); return {}; @@ -702,8 +701,8 @@ describe("LocalWorkspace", () => { assert.strictEqual(destroyRes.summary.result, "succeeded"); await stack.workspace.removeStack(stackName); - })); - it(`detects inline programs with side by side pulumi and throws an error`, asyncTest(async () => { + }); + it(`detects inline programs with side by side pulumi and throws an error`, async () => { const program = async () => { // clear pulumi/pulumi from require cache @@ -734,13 +733,13 @@ describe("LocalWorkspace", () => { assert.strictEqual(destroyRes.summary.result, "succeeded"); await stack.workspace.removeStack(stackName); - })); - it(`sets pulumi version`, asyncTest(async () => { + }); + it(`sets pulumi version`, async () => { const ws = await LocalWorkspace.create({}); assert(ws.pulumiVersion); assert.strictEqual(versionRegex.test(ws.pulumiVersion), true); - })); - it(`respects existing project settings`, asyncTest(async () => { + }); + it(`respects existing project settings`, async () => { const projectName = "correct_project"; const stackName = fullyQualifiedStackName(getTestOrg(), projectName, `int_test${getTestSuffix()}`); const stack = await LocalWorkspace.createStack( @@ -752,8 +751,8 @@ describe("LocalWorkspace", () => { // the description check is enough to verify that the stack wasn't overwritten assert.strictEqual(projectSettings.description, "This is a description"); await stack.workspace.removeStack(stackName); - })); - it(`correctly sets config on multiple stacks concurrently`, asyncTest(async () => { + }); + it(`correctly sets config on multiple stacks concurrently`, async () => { const dones = []; const stacks = ["dev", "dev2", "dev3", "dev4", "dev5"]; const workDir = upath.joinSafe(__dirname, "data", "tcfg"); @@ -791,7 +790,7 @@ describe("LocalWorkspace", () => { assert.strictEqual(Object.keys(config).length, 20); await stack.workspace.removeStack(stacks[i]); } - })); + }); }); const MAJOR = /Major version mismatch./; diff --git a/sdk/nodejs/tests/iterable.spec.ts b/sdk/nodejs/tests/iterable.spec.ts index a349f480d441..ba07d30c1c8b 100644 --- a/sdk/nodejs/tests/iterable.spec.ts +++ b/sdk/nodejs/tests/iterable.spec.ts @@ -15,10 +15,9 @@ import * as assert from "assert"; import * as iterable from "../iterable"; import { Output } from "../output"; -import { asyncTest } from "./util"; describe("iterable", () => { - it("toMap does its job", asyncTest(async () => { + it("toMap does its job", async () => { interface Instance { id: Output; privateIp: Output; @@ -34,8 +33,8 @@ describe("iterable", () => { assert.strictEqual(isKnown, true); const value = await result.promise(); assert.deepStrictEqual(value, { "i-1234": "192.168.1.2", "i-5678": "192.168.1.5" }); - })); - it("groupBy does its job", asyncTest(async () => { + }); + it("groupBy does its job", async () => { interface Instance { id: Output; availabilityZone: Output; @@ -52,5 +51,5 @@ describe("iterable", () => { assert.strictEqual(isKnown, true); const value = await result.promise(); assert.deepStrictEqual(value, { "us-east-1a": ["i-1234", "i-5678"], "us-west-2c": ["i-1538"] }); - })); + }); }); diff --git a/sdk/nodejs/tests/options.spec.ts b/sdk/nodejs/tests/options.spec.ts index 8beafb2f41c1..0de316e58c7f 100644 --- a/sdk/nodejs/tests/options.spec.ts +++ b/sdk/nodejs/tests/options.spec.ts @@ -16,69 +16,68 @@ import * as assert from "assert"; import { ComponentResourceOptions, ProviderResource, merge, mergeOptions } from "../resource"; -import { asyncTest } from "./util"; describe("options", () => { describe("merge", () => { describe("scaler", () => { - it("keeps value from opts1 if not provided in opts2", asyncTest(async () => { + it("keeps value from opts1 if not provided in opts2", async () => { const result = mergeOptions({ id: "a" }, {}); assert.strictEqual(result.id, "a"); - })); - it("keeps value from opts2 if not provided in opts1", asyncTest(async () => { + }); + it("keeps value from opts2 if not provided in opts1", async () => { const result = mergeOptions({ }, { id: "a" }); assert.strictEqual(result.id, "a"); - })); - it("overwrites value from opts1 if given null in opts2", asyncTest(async () => { + }); + it("overwrites value from opts1 if given null in opts2", async () => { const result = mergeOptions({ id: "a" }, { id: null! }); assert.strictEqual(result.id, null); - })); - it("overwrites value from opts1 if given undefined in opts2", asyncTest(async () => { + }); + it("overwrites value from opts1 if given undefined in opts2", async () => { const result = mergeOptions({ id: "a" }, { id: undefined }); assert.strictEqual(result.id, undefined); - })); - it("overwrites value from opts1 if given value in opts2", asyncTest(async () => { + }); + it("overwrites value from opts1 if given value in opts2", async () => { const result = mergeOptions({ id: "a" }, { id: "b" }); assert.strictEqual(result.id, "b"); - })); - it("overwrites promise-value from opts1 if given value in opts2", asyncTest(async () => { + }); + it("overwrites promise-value from opts1 if given value in opts2", async () => { const result: any = mergeOptions({ id: Promise.resolve("a") }, { id: "b" }); assert.strictEqual(await result.id.promise(), "b"); - })); - it("overwrites value from opts1 if given promise-value in opts2", asyncTest(async () => { + }); + it("overwrites value from opts1 if given promise-value in opts2", async () => { const result: any = mergeOptions({ id: "a" }, { id: Promise.resolve("b") }); assert.strictEqual(await result.id.promise(), "b"); - })); - it("overwrites promise-value from opts1 if given promise-value in opts2", asyncTest(async () => { + }); + it("overwrites promise-value from opts1 if given promise-value in opts2", async () => { const result: any = mergeOptions({ id: Promise.resolve("a") }, { id: Promise.resolve("b") }); assert.strictEqual(await result.id.promise(), "b"); - })); + }); }); describe("array", () => { - it("keeps value from opts1 if not provided in opts2", asyncTest(async () => { + it("keeps value from opts1 if not provided in opts2", async () => { const result = mergeOptions({ ignoreChanges: ["a"] }, {}); assert.deepStrictEqual(result.ignoreChanges, ["a"]); - })); - it("keeps value from opts2 if not provided in opts1", asyncTest(async () => { + }); + it("keeps value from opts2 if not provided in opts1", async () => { const result = mergeOptions({ }, { ignoreChanges: ["a"] }); assert.deepStrictEqual(result.ignoreChanges, ["a"]); - })); - it("does nothing to value from opts1 if given null in opts2", asyncTest(async () => { + }); + it("does nothing to value from opts1 if given null in opts2", async () => { const result = mergeOptions({ ignoreChanges: ["a"] }, { ignoreChanges: null! }); assert.deepStrictEqual(result.ignoreChanges, ["a"]); - })); - it("does nothing to value from opts1 if given undefined in opts2", asyncTest(async () => { + }); + it("does nothing to value from opts1 if given undefined in opts2", async () => { const result = mergeOptions({ ignoreChanges: ["a"] }, { ignoreChanges: undefined }); assert.deepStrictEqual(result.ignoreChanges, ["a"]); - })); - it("merges values from opts1 if given value in opts2", asyncTest(async () => { + }); + it("merges values from opts1 if given value in opts2", async () => { const result = mergeOptions({ ignoreChanges: ["a"] }, { ignoreChanges: ["b"] }); assert.deepStrictEqual(result.ignoreChanges, ["a", "b"]); - })); + }); describe("including promises", () => { - it("merges non-promise in opts1 and promise in opts2", asyncTest(async () => { + it("merges non-promise in opts1 and promise in opts2", async () => { const result = mergeOptions({ aliases: ["a"] }, { aliases: [Promise.resolve("b")] }); const aliases = result.aliases!; assert.deepStrictEqual(Array.isArray(aliases), true); @@ -88,8 +87,8 @@ describe("options", () => { const val1 = await aliases[1]; assert.deepStrictEqual(val1, "b"); - })); - it("merges promise in opts1 and non-promise in opts2", asyncTest(async () => { + }); + it("merges promise in opts1 and non-promise in opts2", async () => { const result = mergeOptions({ aliases: [Promise.resolve("a")] }, { aliases: ["b"] }); const aliases = result.aliases!; assert.deepStrictEqual(Array.isArray(aliases), true); @@ -99,33 +98,33 @@ describe("options", () => { const val0 = await aliases[0]; assert.deepStrictEqual(val0, "a"); - })); + }); }); }); describe("arrayTransformations", () => { const a = () => undefined; const b = () => undefined; - it("keeps value from opts1 if not provided in opts2", asyncTest(async () => { + it("keeps value from opts1 if not provided in opts2", async () => { const result = mergeOptions({ transformations: [a] }, {}); assert.deepStrictEqual(result.transformations, [a]); - })); - it("keeps value from opts2 if not provided in opts1", asyncTest(async () => { + }); + it("keeps value from opts2 if not provided in opts1", async () => { const result = mergeOptions({ }, { transformations: [a] }); assert.deepStrictEqual(result.transformations, [a]); - })); - it("does nothing to value from opts1 if given null in opts2", asyncTest(async () => { + }); + it("does nothing to value from opts1 if given null in opts2", async () => { const result = mergeOptions({ transformations: [a] }, { transformations: null! }); assert.deepStrictEqual(result.transformations, [a]); - })); - it("does nothing to value from opts1 if given undefined in opts2", asyncTest(async () => { + }); + it("does nothing to value from opts1 if given undefined in opts2", async () => { const result = mergeOptions({ transformations: [a] }, { transformations: undefined }); assert.deepStrictEqual(result.transformations, [a]); - })); - it("merges values from opts1 if given value in opts2", asyncTest(async () => { + }); + it("merges values from opts1 if given value in opts2", async () => { const result = mergeOptions({ transformations: [a] }, { transformations: [b] }); assert.deepStrictEqual(result.transformations, [a, b]); - })); + }); }); describe("providers", () => { diff --git a/sdk/nodejs/tests/output.spec.ts b/sdk/nodejs/tests/output.spec.ts index 05235bc79164..d957c17e7f64 100644 --- a/sdk/nodejs/tests/output.spec.ts +++ b/sdk/nodejs/tests/output.spec.ts @@ -18,7 +18,6 @@ import * as assert from "assert"; import { Output, all, concat, interpolate, output, unknown, secret, unsecret, isSecret } from "../output"; import { Resource } from "../resource"; import * as runtime from "../runtime"; -import { asyncTest } from "./util"; interface Widget { type: string; // metric | text @@ -64,7 +63,7 @@ function mockOutput(isKnown: boolean | Promise, value: any | Promise { - it("propagates true isKnown bit from inner Output", asyncTest(async () => { + it("propagates true isKnown bit from inner Output", async () => { runtime._setIsDryRun(true); const output1 = new Output(new Set(), Promise.resolve("outer"), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -75,9 +74,9 @@ describe("output", () => { const value = await output2.promise(); assert.strictEqual(value, "inner"); - })); + }); - it("propagates false isKnown bit from inner Output", asyncTest(async () => { + it("propagates false isKnown bit from inner Output", async () => { runtime._setIsDryRun(true); const output1 = new Output(new Set(), Promise.resolve("outer"), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -88,9 +87,9 @@ describe("output", () => { const value = await output2.promise(); assert.strictEqual(value, "inner"); - })); + }); - it("can not await if isKnown is a rejected promise.", asyncTest(async () => { + it("can not await if isKnown is a rejected promise.", async () => { runtime._setIsDryRun(true); const output1 = new Output(new Set(), Promise.resolve("outer"), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -109,9 +108,9 @@ describe("output", () => { } catch (err) { } - })); + }); - it("propagates true isSecret bit from inner Output", asyncTest(async () => { + it("propagates true isSecret bit from inner Output", async () => { runtime._setIsDryRun(true); const output1 = new Output(new Set(), Promise.resolve("outer"), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -122,9 +121,9 @@ describe("output", () => { const value = await output2.promise(); assert.strictEqual(value, "inner"); - })); + }); - it("retains true isSecret bit from outer Output", asyncTest(async () => { + it("retains true isSecret bit from outer Output", async () => { runtime._setIsDryRun(true); const output1 = new Output(new Set(), Promise.resolve("outer"), Promise.resolve(true), Promise.resolve(true), Promise.resolve(new Set())); @@ -135,7 +134,7 @@ describe("output", () => { const value = await output2.promise(); assert.strictEqual(value, "inner"); - })); + }); describe("apply", () => { function createOutput(val: T, isKnown: boolean, isSecret: boolean = false): Output { @@ -143,7 +142,7 @@ describe("output", () => { Promise.resolve(new Set())); } - it("can run on known value during preview", asyncTest(async () => { + it("can run on known value during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true); @@ -151,9 +150,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), 1); - })); + }); - it("can run on known awaitable value during preview", asyncTest(async () => { + it("can run on known awaitable value during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true); @@ -161,9 +160,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("can run on known known output value during preview", asyncTest(async () => { + it("can run on known known output value during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true); @@ -171,9 +170,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("can run on known unknown output value during preview", asyncTest(async () => { + it("can run on known unknown output value during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true); @@ -181,9 +180,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("produces unknown default on unknown during preview", asyncTest(async () => { + it("produces unknown default on unknown during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false); @@ -191,9 +190,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("produces unknown default on unknown awaitable during preview", asyncTest(async () => { + it("produces unknown default on unknown awaitable during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false); @@ -201,9 +200,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("produces unknown default on unknown known output during preview", asyncTest(async () => { + it("produces unknown default on unknown known output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false); @@ -211,9 +210,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("produces unknown default on unknown unknown output during preview", asyncTest(async () => { + it("produces unknown default on unknown unknown output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false); @@ -221,9 +220,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("preserves secret on known during preview", asyncTest(async () => { + it("preserves secret on known during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true, true); @@ -232,9 +231,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), 1); - })); + }); - it("preserves secret on known awaitable during preview", asyncTest(async () => { + it("preserves secret on known awaitable during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true, true); @@ -243,9 +242,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on known known output during preview", asyncTest(async () => { + it("preserves secret on known known output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true, true); @@ -254,9 +253,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on known unknown output during preview", asyncTest(async () => { + it("preserves secret on known unknown output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true, true); @@ -265,9 +264,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on unknown during preview", asyncTest(async () => { + it("preserves secret on unknown during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false, true); @@ -276,9 +275,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("preserves secret on unknown awaitable during preview", asyncTest(async () => { + it("preserves secret on unknown awaitable during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false, true); @@ -287,9 +286,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("preserves secret on unknown known output during preview", asyncTest(async () => { + it("preserves secret on unknown known output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false, true); @@ -298,9 +297,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("preserves secret on unknown unknown output during preview", asyncTest(async () => { + it("preserves secret on unknown unknown output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false, true); @@ -309,9 +308,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("propagates secret on known known output during preview", asyncTest(async () => { + it("propagates secret on known known output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true); @@ -320,9 +319,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("propagates secret on known unknown output during preview", asyncTest(async () => { + it("propagates secret on known unknown output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, true); @@ -331,9 +330,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("does not propagate secret on unknown known output during preview", asyncTest(async () => { + it("does not propagate secret on unknown known output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false); @@ -342,9 +341,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, false); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("does not propagate secret on unknown unknown output during preview", asyncTest(async () => { + it("does not propagate secret on unknown unknown output during preview", async () => { runtime._setIsDryRun(true); const out = createOutput(0, false); @@ -353,9 +352,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, false); assert.strictEqual(await r.promise(), undefined); - })); + }); - it("can run on known value", asyncTest(async () => { + it("can run on known value", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true); @@ -363,9 +362,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), 1); - })); + }); - it("can run on known awaitable value", asyncTest(async () => { + it("can run on known awaitable value", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true); @@ -373,9 +372,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("can run on known known output value", asyncTest(async () => { + it("can run on known known output value", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true); @@ -383,9 +382,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("can run on unknown known output value", asyncTest(async () => { + it("can run on unknown known output value", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true); @@ -393,9 +392,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("produces known on unknown", asyncTest(async () => { + it("produces known on unknown", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false); @@ -403,9 +402,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), 1); - })); + }); - it("produces known on unknown awaitable", asyncTest(async () => { + it("produces known on unknown awaitable", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false); @@ -413,9 +412,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("produces known on unknown known output", asyncTest(async () => { + it("produces known on unknown known output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false); @@ -423,9 +422,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("produces unknown on unknown unknown output", asyncTest(async () => { + it("produces unknown on unknown unknown output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false); @@ -433,9 +432,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on known", asyncTest(async () => { + it("preserves secret on known", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true, true); @@ -444,9 +443,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), 1); - })); + }); - it("preserves secret on known awaitable", asyncTest(async () => { + it("preserves secret on known awaitable", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true, true); @@ -455,9 +454,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on known known output", asyncTest(async () => { + it("preserves secret on known known output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true, true); @@ -466,9 +465,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on known known output", asyncTest(async () => { + it("preserves secret on known known output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true, true); @@ -477,9 +476,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on unknown", asyncTest(async () => { + it("preserves secret on unknown", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false, true); @@ -488,9 +487,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), 1); - })); + }); - it("preserves secret on unknown awaitable", asyncTest(async () => { + it("preserves secret on unknown awaitable", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false, true); @@ -499,9 +498,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on unknown known output", asyncTest(async () => { + it("preserves secret on unknown known output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false, true); @@ -510,9 +509,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("preserves secret on unknown known output", asyncTest(async () => { + it("preserves secret on unknown known output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false, true); @@ -521,9 +520,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("propagates secret on known known output", asyncTest(async () => { + it("propagates secret on known known output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true); @@ -532,9 +531,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("propagates secret on known unknown output", asyncTest(async () => { + it("propagates secret on known unknown output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, true); @@ -543,9 +542,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("propagates secret on unknown known output", asyncTest(async () => { + it("propagates secret on unknown known output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false); @@ -554,9 +553,9 @@ describe("output", () => { assert.strictEqual(await r.isKnown, true); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); - it("propagates secret on unknown uknown output", asyncTest(async () => { + it("propagates secret on unknown uknown output", async () => { runtime._setIsDryRun(false); const out = createOutput(0, false); @@ -565,7 +564,7 @@ describe("output", () => { assert.strictEqual(await r.isKnown, false); assert.strictEqual(await r.isSecret, true); assert.strictEqual(await r.promise(), "inner"); - })); + }); }); describe("isKnown", () => { @@ -584,7 +583,7 @@ describe("output", () => { .then(([r1, r2]) => new Set([...r1, ...r2]))); } - it("choose between known and known output, non-secret", asyncTest(async () => { + it("choose between known and known output, non-secret", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve("foo"), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -600,9 +599,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, false); - })); + }); - it("choose between known and known output, secret", asyncTest(async () => { + it("choose between known and known output, secret", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve("foo"), Promise.resolve(true), Promise.resolve(true), Promise.resolve(new Set())); @@ -618,9 +617,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, true); - })); + }); - it("choose between known and unknown output, non-secret", asyncTest(async () => { + it("choose between known and unknown output, non-secret", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve("foo"), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -636,9 +635,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, false); - })); + }); - it("choose between known and unknown output, secret", asyncTest(async () => { + it("choose between known and unknown output, secret", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve("foo"), Promise.resolve(true), Promise.resolve(true), Promise.resolve(new Set())); @@ -654,9 +653,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, true); - })); + }); - it("choose between unknown and known output, non-secret", asyncTest(async () => { + it("choose between unknown and known output, non-secret", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve(undefined), Promise.resolve(false), Promise.resolve(false), Promise.resolve(new Set())); @@ -672,9 +671,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, false); - })); + }); - it("choose between unknown and known output, secret", asyncTest(async () => { + it("choose between unknown and known output, secret", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve(undefined), Promise.resolve(false), Promise.resolve(false), Promise.resolve(new Set())); @@ -690,9 +689,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, true); - })); + }); - it("choose between unknown and unknown output, non-secret", asyncTest(async () => { + it("choose between unknown and unknown output, non-secret", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve(undefined), Promise.resolve(false), Promise.resolve(false), Promise.resolve(new Set())); @@ -708,9 +707,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, false); - })); + }); - it("choose between unknown and unknown output, secret1", asyncTest(async () => { + it("choose between unknown and unknown output, secret1", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve(undefined), Promise.resolve(false), Promise.resolve(true), Promise.resolve(new Set())); @@ -726,9 +725,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, false); - })); + }); - it("choose between unknown and unknown output, secret2", asyncTest(async () => { + it("choose between unknown and unknown output, secret2", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve(undefined), Promise.resolve(false), Promise.resolve(false), Promise.resolve(new Set())); @@ -744,9 +743,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, true); - })); + }); - it("choose between unknown and unknown output, secret3", asyncTest(async () => { + it("choose between unknown and unknown output, secret3", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve(undefined), Promise.resolve(false), Promise.resolve(true), Promise.resolve(new Set())); @@ -762,9 +761,9 @@ describe("output", () => { const secret = await result.isSecret; assert.strictEqual(secret, true); - })); + }); - it("is unknown if the value is or contains unknowns", asyncTest(async () => { + it("is unknown if the value is or contains unknowns", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve(unknown), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -774,9 +773,9 @@ describe("output", () => { assert.strictEqual(await o1.isKnown, false); assert.strictEqual(await o2.isKnown, false); assert.strictEqual(await o3.isKnown, false); - })); + }); - it("is unknown if the result after apply is unknown or contains unknowns", asyncTest(async () => { + it("is unknown if the result after apply is unknown or contains unknowns", async () => { runtime._setIsDryRun(true); const o1 = new Output(new Set(), Promise.resolve("foo"), Promise.resolve(true), Promise.resolve(false), Promise.resolve(new Set())); @@ -793,90 +792,90 @@ describe("output", () => { assert.strictEqual(await r4.isKnown, false); assert.strictEqual(await r5.isKnown, false); assert.strictEqual(await r6.isKnown, false); - })); + }); }); describe("concat", () => { - it ("handles no args", asyncTest(async () => { + it ("handles no args", async () => { const result = concat(); assert.strictEqual(await result.promise(), ""); - })); + }); - it ("handles empty string arg", asyncTest(async () => { + it ("handles empty string arg", async () => { const result = concat(""); assert.strictEqual(await result.promise(), ""); - })); + }); - it ("handles non-empty string arg", asyncTest(async () => { + it ("handles non-empty string arg", async () => { const result = concat("a"); assert.strictEqual(await result.promise(), "a"); - })); + }); - it ("handles promise string arg", asyncTest(async () => { + it ("handles promise string arg", async () => { const result = concat(Promise.resolve("a")); assert.strictEqual(await result.promise(), "a"); - })); + }); - it ("handles output string arg", asyncTest(async () => { + it ("handles output string arg", async () => { const result = concat(output("a")); assert.strictEqual(await result.promise(), "a"); - })); + }); - it ("handles multiple args", asyncTest(async () => { + it ("handles multiple args", async () => { const result = concat("http://", output("a"), ":", 80); assert.strictEqual(await result.promise(), "http://a:80"); - })); + }); }); describe("interpolate", () => { - it ("handles empty interpolation", asyncTest(async () => { + it ("handles empty interpolation", async () => { const result = interpolate ``; assert.strictEqual(await result.promise(), ""); - })); + }); - it ("handles no placeholders arg", asyncTest(async () => { + it ("handles no placeholders arg", async () => { const result = interpolate `a`; assert.strictEqual(await result.promise(), "a"); - })); + }); - it ("handles string placeholders arg", asyncTest(async () => { + it ("handles string placeholders arg", async () => { const result = interpolate `${"a"}`; assert.strictEqual(await result.promise(), "a"); - })); + }); - it ("handles promise placeholders arg", asyncTest(async () => { + it ("handles promise placeholders arg", async () => { const result = interpolate `${Promise.resolve("a")}`; assert.strictEqual(await result.promise(), "a"); - })); + }); - it ("handles output placeholders arg", asyncTest(async () => { + it ("handles output placeholders arg", async () => { const result = interpolate `${output("a")}`; assert.strictEqual(await result.promise(), "a"); - })); + }); - it ("handles multiple args", asyncTest(async () => { + it ("handles multiple args", async () => { const result = interpolate `http://${output("a")}:${80}/`; assert.strictEqual(await result.promise(), "http://a:80/"); - })); + }); }); describe("secret operations", () => { - it("ensure secret", asyncTest(async () => { + it("ensure secret", async () => { const sec = secret("foo"); assert.strictEqual(await sec.isSecret, true) - })); - it("ensure that a secret can be unwrapped", asyncTest(async () => { + }); + it("ensure that a secret can be unwrapped", async () => { const sec = secret("foo"); assert.strictEqual(await isSecret(sec), true) const unsec = unsecret(sec); assert.strictEqual(await isSecret(unsec), false) assert.strictEqual(await unsec.promise(), "foo") - })); + }); }); describe("lifted operations", () => { - it("lifts properties from inner object", asyncTest(async () => { + it("lifts properties from inner object", async () => { const output1 = output({ a: 1, b: true, c: "str", d: [2], e: { f: 3 }, g: undefined, h: null }); assert.strictEqual(await output1.a.promise(), 1); @@ -897,25 +896,25 @@ describe("output", () => { // Unspecified things can be lifted, but produce 'undefined'. assert.notEqual((output1).z, undefined); assert.strictEqual(await (output1).z.promise(), undefined); - })); + }); - it("prefers Output members over lifted members", asyncTest(async () => { + it("prefers Output members over lifted members", async () => { const output1 = output({ apply: 1, promise: 2 }); assert.ok(output1.apply instanceof Function); assert.ok(output1.isKnown instanceof Promise); - })); + }); - it("does not lift symbols", asyncTest(async () => { + it("does not lift symbols", async () => { const output1 = output({ apply: 1, promise: 2 }); assert.strictEqual((output1)[Symbol.toPrimitive], undefined); - })); + }); - it("does not lift __ properties", asyncTest(async () => { + it("does not lift __ properties", async () => { const output1 = output({ a: 1, b: 2 }); assert.strictEqual((output1).__pulumiResource, undefined); - })); + }); - it("lifts properties from values with nested unknowns", asyncTest(async () => { + it("lifts properties from values with nested unknowns", async () => { runtime._setIsDryRun(true); const output1 = output({ @@ -1008,6 +1007,6 @@ describe("output", () => { const result18 = (result16).qux; assert.strictEqual(await result18.isKnown, false); assert.strictEqual(await (result18).promise(/*withUnknowns*/ true), unknown); - })); + }); }); }); diff --git a/sdk/nodejs/tests/provider.spec.ts b/sdk/nodejs/tests/provider.spec.ts index 03dbec6d5cb4..5c5c06cb4a6f 100644 --- a/sdk/nodejs/tests/provider.spec.ts +++ b/sdk/nodejs/tests/provider.spec.ts @@ -13,7 +13,6 @@ // limitations under the License. import * as assert from "assert"; -import { asyncTest } from "./util"; import * as pulumi from ".."; import * as internals from "../provider/internals"; @@ -51,14 +50,14 @@ class TestMocks implements pulumi.runtime.Mocks { } describe("provider", () => { - it("parses arguments generated by --logflow", asyncTest(async () => { + it("parses arguments generated by --logflow", async () => { const parsedArgs = internals.parseArgs(["--logtostderr", "-v=9", "--tracing", "127.0.0.1:6007", "127.0.0.1:12345"]); if (parsedArgs !== undefined) { assert.strictEqual("127.0.0.1:12345", parsedArgs.engineAddress); } else { assert.fail("failed to parse"); } - })); + }); describe("deserializeInputs", () => { beforeEach(() => { @@ -464,7 +463,7 @@ describe("provider", () => { }, ]; for (const test of tests) { - it(`deserializes '${test.name}' correctly`, asyncTest(async () => { + it(`deserializes '${test.name}' correctly`, async () => { pulumi.runtime.setMocks(new TestMocks(), "project", "stack", true); pulumi.runtime.registerResourceModule("test", "index", new TestModule()); new TestResource("name"); // Create an instance so it can be deserialized. @@ -484,7 +483,7 @@ describe("provider", () => { } else { assert.deepStrictEqual(actual, test.expected); } - })); + }); } }); diff --git a/sdk/nodejs/tests/resource.spec.ts b/sdk/nodejs/tests/resource.spec.ts index 29f87b3f5483..a0bd2f5828b0 100644 --- a/sdk/nodejs/tests/resource.spec.ts +++ b/sdk/nodejs/tests/resource.spec.ts @@ -17,7 +17,6 @@ import * as assert from "assert"; import { all } from "../output"; import * as runtime from "../runtime"; -import { asyncTest } from "./util"; import { allAliases, createUrn, ComponentResource, CustomResourceOptions, DependencyProviderResource } from "../resource"; class MyResource extends ComponentResource { @@ -45,22 +44,22 @@ describe("createUrn", () => { runtime._setStack(undefined); }) - it("handles name and type", asyncTest(async () => { + it("handles name and type", async () => { const urn = await createUrn("n", "t").promise(); assert.strictEqual(urn, "urn:pulumi:mystack::myproject::t::n"); - })); + }); - it("handles name and type and parent", asyncTest(async () => { + it("handles name and type and parent", async () => { const res = new MyResource("myres"); const urn = await createUrn("n", "t", res).promise(); assert.strictEqual(urn, "urn:pulumi:mystack::myproject::my:mod:MyResource$t::n"); - })); + }); - it("handles name and type and parent with parent", asyncTest(async () => { + it("handles name and type and parent with parent", async () => { const res = new MyParentResource("myres"); const urn = await createUrn("n", "t", res.child).promise(); assert.strictEqual(urn, "urn:pulumi:mystack::myproject::my:mod:MyParentResource$my:mod:MyResource$t::n"); - })); + }); }); class TestResource extends ComponentResource { @@ -140,7 +139,7 @@ describe("allAliases", () => { ]; for (const testCase of testCases) { - it(testCase.name, asyncTest(async () => { + it(testCase.name, async () => { const res = new TestResource("myres", { aliases: testCase.parentAliases }); const aliases = allAliases(testCase.childAliases, "myres-child", "test:resource:child", res, "myres"); assert.strictEqual(aliases.length, testCase.results.length); @@ -148,7 +147,7 @@ describe("allAliases", () => { for (let i = 0; i < aliasURNs.length; i++) { assert.strictEqual(aliasURNs[i], testCase.results[i]); } - })); + }); } }); diff --git a/sdk/nodejs/tests/runtime/asyncIterableUtil.spec.ts b/sdk/nodejs/tests/runtime/asyncIterableUtil.spec.ts index 672a82780210..ddb113f95247 100644 --- a/sdk/nodejs/tests/runtime/asyncIterableUtil.spec.ts +++ b/sdk/nodejs/tests/runtime/asyncIterableUtil.spec.ts @@ -16,7 +16,6 @@ import { AsyncIterable } from "@pulumi/query/interfaces"; import * as assert from "assert"; import { PushableAsyncIterable } from "../../runtime/asyncIterableUtil"; -import { asyncTest } from "../util"; async function enumerate(ts: AsyncIterable): Promise { const tss: T[] = []; @@ -29,38 +28,38 @@ async function enumerate(ts: AsyncIterable): Promise { describe("PushableAsyncIterable", () => { it( "correctly produces empty sequence", - asyncTest(async () => { + async () => { const queue = new PushableAsyncIterable(); queue.complete(); assert.deepStrictEqual(await enumerate(queue), []); - }), + }, ); it( "correctly produces singleton sequence", - asyncTest(async () => { + async () => { const queue = new PushableAsyncIterable(); queue.push(1); queue.complete(); assert.deepStrictEqual(await enumerate(queue), [1]); - }), + }, ); it( "correctly produces multiple sequence", - asyncTest(async () => { + async () => { const queue = new PushableAsyncIterable(); queue.push(1); queue.push(2); queue.push(3); queue.complete(); assert.deepStrictEqual(await enumerate(queue), [1, 2, 3]); - }), + }, ); it( "correctly terminates outstanding operations afte complete", - asyncTest(async () => { + async () => { const queue = new PushableAsyncIterable(); const queueIter = queue[Symbol.asyncIterator](); const terminates = new Promise(async resolve => { @@ -72,12 +71,12 @@ describe("PushableAsyncIterable", () => { queue.complete(); await terminates; assert.deepStrictEqual(await queueIter.next(), { value: undefined, done: true }); - }), + }, ); it( "correctly interleaves operations", - asyncTest(async () => { + async () => { const queue = new PushableAsyncIterable(); const queueIter = queue[Symbol.asyncIterator](); queue.push(1); @@ -96,6 +95,6 @@ describe("PushableAsyncIterable", () => { assert.deepStrictEqual(await queueIter.next(), { value: 7, done: false }); queue.complete(); assert.deepStrictEqual(await queueIter.next(), { value: undefined, done: true }); - }), + }, ); }); diff --git a/sdk/nodejs/tests/runtime/langhost/run.spec.ts b/sdk/nodejs/tests/runtime/langhost/run.spec.ts index 72013bfade05..73d9b35e1e05 100644 --- a/sdk/nodejs/tests/runtime/langhost/run.spec.ts +++ b/sdk/nodejs/tests/runtime/langhost/run.spec.ts @@ -16,7 +16,6 @@ import assert from "assert"; import * as childProcess from "child_process"; import * as path from "path"; import { ID, runtime, URN } from "../../../index"; -import { asyncTest } from "../../util"; import { platformIndependentEOL } from "../../constants"; import * as grpc from "@grpc/grpc-js"; @@ -1272,7 +1271,7 @@ describe("rpc", () => { const testFn = opts.only ? it.only : it; - testFn(`run test: ${casename} (pwd=${opts.pwd},prog=${opts.program})`, asyncTest(async () => { + testFn(`run test: ${casename} (pwd=${opts.pwd},prog=${opts.program})`, async () => { // For each test case, run it twice: first to preview and then to update. for (const dryrun of [true, false]) { // console.log(dryrun ? "PREVIEW:" : "UPDATE:"); @@ -1465,7 +1464,7 @@ describe("rpc", () => { } } } - })); + }); } }); diff --git a/sdk/nodejs/tests/runtime/props.spec.ts b/sdk/nodejs/tests/runtime/props.spec.ts index 3c228fd91e79..0699f2ec1c14 100644 --- a/sdk/nodejs/tests/runtime/props.spec.ts +++ b/sdk/nodejs/tests/runtime/props.spec.ts @@ -15,7 +15,6 @@ import * as assert from "assert"; import { ComponentResource, CustomResource, DependencyResource, Inputs, Output, Resource, ResourceOptions, runtime, secret } from "../../index"; -import { asyncTest } from "../util"; const gstruct = require("google-protobuf/google/protobuf/struct_pb.js"); @@ -188,7 +187,7 @@ describe("runtime", () => { } for (const test of generateTests()) { - it(`marshals ${test.name} correctly`, asyncTest(async () => { + it(`marshals ${test.name} correctly`, async () => { runtime._setFeatureSupport("outputValues", true); const inputs = { value: test.input }; @@ -200,11 +199,11 @@ describe("runtime", () => { // Roundtrip. const back = runtime.deserializeProperties(gstruct.Struct.fromJavaScript(actual)); await assertOutputsEqual(back.value, test.expectedRoundTrip); - })); + }); } }); - it("marshals basic properties correctly", asyncTest(async () => { + it("marshals basic properties correctly", async () => { const inputs: TestInputs = { "aNum": 42, "bStr": "a string", @@ -231,8 +230,8 @@ describe("runtime", () => { assert.strictEqual(result.intEnum, TestIntEnum.One); assert.strictEqual(result.numEnum, TestNumEnum.One); assert.strictEqual(result.boolEnum, TestBoolEnum.One); - })); - it("marshals secrets correctly", asyncTest(async () => { + }); + it("marshals secrets correctly", async () => { const inputs: Inputs = { "secret1": secret(1), "secret2": secret(undefined), @@ -257,8 +256,8 @@ describe("runtime", () => { assert.ok(!runtime.isRpcSecret(result.secret2)); assert.strictEqual(result.secret1, 1); assert.strictEqual(result.secret2, undefined); - })); - it("marshals resource references correctly during preview", asyncTest(async () => { + }); + it("marshals resource references correctly during preview", async () => { runtime._setIsDryRun(true); runtime.setMocks(new TestMocks()); @@ -295,9 +294,9 @@ describe("runtime", () => { "component": componentURN, "custom": customID ? customID : runtime.unknownValue, }); - })); + }); - it("marshals resource references correctly during update", asyncTest(async () => { + it("marshals resource references correctly during update", async () => { runtime.setMocks(new TestMocks()); const component = new TestComponentResource("test"); @@ -333,7 +332,7 @@ describe("runtime", () => { "component": componentURN, "custom": customID, }); - })); + }); }); describe("deserializeProperty", () => { @@ -394,7 +393,7 @@ describe("runtime", () => { assert.strictEqual(result.listWithMap.value[0].regular, "a normal value"); assert.strictEqual(result.listWithMap.value[0].secret, "a secret value"); }); - it("deserializes resource references properly during preview", asyncTest(async () => { + it("deserializes resource references properly during preview", async () => { runtime.setMocks(new TestMocks()); runtime._setFeatureSupport("resourceReferences", true); runtime.registerResourceModule("test", "index", new TestResourceModule()); @@ -430,11 +429,11 @@ describe("runtime", () => { assert.ok((deserialized["component"]).__pulumiComponentResource); assert.ok((deserialized["custom"]).__pulumiCustomResource); assert.deepEqual(deserialized["unregistered"], unregisteredID); - })); + }); }); describe("resource error handling", () => { - it("registerResource errors propagate appropriately", asyncTest(async () => { + it("registerResource errors propagate appropriately", async () => { runtime.setMocks(new TestMocks()); await assert.rejects(async () => { @@ -446,6 +445,6 @@ describe("runtime", () => { const containsRegisterResource = err.stack!.indexOf("registerResource") >= 0; return containsMessage && containsRegisterResource; }); - })); + }); }); }); diff --git a/sdk/nodejs/tests/runtime/tsClosureCases.ts b/sdk/nodejs/tests/runtime/tsClosureCases.ts index 719c1acfc26f..eed6ef740047 100644 --- a/sdk/nodejs/tests/runtime/tsClosureCases.ts +++ b/sdk/nodejs/tests/runtime/tsClosureCases.ts @@ -18,7 +18,6 @@ import * as assert from "assert"; import { runtime } from "../../index"; import * as pulumi from "../../index"; import { output } from "../../output"; -import { assertAsyncThrows, asyncTest } from "../util"; import { platformIndependentEOL } from "../constants"; import * as typescript from "typescript"; import * as semver from "semver"; @@ -6705,7 +6704,7 @@ return function /*reproHandler*/(input) { // continue; // } - it(test.title, asyncTest(async () => { + it(test.title, async () => { // Run pre-actions. if (test.pre) { test.pre(); @@ -6717,19 +6716,20 @@ return function /*reproHandler*/(input) { compareTextWithWildcards(test.expectText, sf.text); } else { - const message = await assertAsyncThrows(async () => { + await assert.rejects(async () => { await serializeFunction(test); + }, err => { + if (test.error) { + // replace real locations with (0,0) so that our test baselines do not need to + // updated any time this file changes. + const regex = /\([0-9]+,[0-9]+\)/g; + const withoutLocations = err.message.replace(regex, "(0,0)"); + compareTextWithWildcards(test.error, withoutLocations); + } + return true; }); - - // replace real locations with (0,0) so that our test baselines do not need to - // updated any time this file changes. - const regex = /\([0-9]+,[0-9]+\)/g; - const withoutLocations = message.replace(regex, "(0,0)"); - if (test.error) { - compareTextWithWildcards(test.error, withoutLocations); - } } - })); + }); // Schedule any additional tests. if (test.afters) { diff --git a/sdk/nodejs/tests/unwrap.spec.ts b/sdk/nodejs/tests/unwrap.spec.ts index e063c7d4013a..51ee2d7e5bc0 100644 --- a/sdk/nodejs/tests/unwrap.spec.ts +++ b/sdk/nodejs/tests/unwrap.spec.ts @@ -16,14 +16,13 @@ import * as assert from "assert"; import { all, output, Output, unknown } from "../index"; -import { asyncTest } from "./util"; function test(val: any, expected: any) { - return asyncTest(async () => { + return async () => { const unwrapped = output(val); const actual = await unwrapped.promise(); assert.deepStrictEqual(actual, expected); - }); + }; } function testUntouched(val: any) { @@ -39,7 +38,7 @@ function testOutput(val: any) { } function testResources(val: any, expected: any, resources: TestResource[], allResources: TestResource[], withUnknowns?: boolean) { - return asyncTest(async () => { + return async () => { const unwrapped = output(val); const actual = await unwrapped.promise(withUnknowns); @@ -55,7 +54,7 @@ function testResources(val: any, expected: any, resources: TestResource[], allRe assert.fail(`async resources did not contain: ${(res).name}`) } } - }); + }; } class TestResource { @@ -278,7 +277,7 @@ describe("unwrap", () => { }); describe("type system", () => { - it ("across promises", asyncTest(async () => { + it ("across promises", async () => { var v = { a: 1, b: Promise.resolve(""), c: { d: true, e: Promise.resolve(4) } }; var xOutput = output(v); var x = await xOutput.promise(); @@ -288,9 +287,9 @@ describe("unwrap", () => { // The runtime value better be a number; x.c.e.toExponential(); - })); + }); - it ("across nested promises", asyncTest(async () => { + it ("across nested promises", async () => { var v = { a: 1, b: Promise.resolve(""), c: Promise.resolve({ d: true, e: Promise.resolve(4) }) }; var xOutput = output(v); var x = await xOutput.promise(); @@ -300,9 +299,9 @@ describe("unwrap", () => { // The runtime value better be a number; x.c.e.toExponential(); - })); + }); - it ("across outputs", asyncTest(async () => { + it ("across outputs", async () => { var v = { a: 1, b: Promise.resolve(""), c: output({ d: true, e: [4, 5, 6] }) }; var xOutput = output(v); var x = await xOutput.promise(); @@ -312,9 +311,9 @@ describe("unwrap", () => { // The runtime value better be a number[] x.c.e.push(1); - })); + }); - it ("across nested outputs", asyncTest(async () => { + it ("across nested outputs", async () => { var v = { a: 1, b: Promise.resolve(""), c: output({ d: true, e: output([4, 5, 6]) }) }; var xOutput = output(v); var x = await xOutput.promise(); @@ -324,9 +323,9 @@ describe("unwrap", () => { // The runtime value better be a number[] x.c.e.push(1); - })); + }); - it ("across promise and output", asyncTest(async () => { + it ("across promise and output", async () => { var v = { a: 1, b: Promise.resolve(""), c: Promise.resolve({ d: true, e: output([4, 5, 6]) }) }; var xOutput = output(v); var x = await xOutput.promise(); @@ -336,9 +335,9 @@ describe("unwrap", () => { // The runtime value better be a number[] x.c.e.push(1); - })); + }); - it ("across output and promise", asyncTest(async () => { + it ("across output and promise", async () => { var v = { a: 1, b: Promise.resolve(""), c: output({ d: true, e: Promise.resolve([4, 5, 6]) }) }; var xOutput = output(v); var x = await xOutput.promise(); @@ -348,14 +347,14 @@ describe("unwrap", () => { // The runtime value better be a number[] x.c.e.push(1); - })); + }); - it ("does not wrap functions", asyncTest(async () => { + it ("does not wrap functions", async () => { var sentinel = function(_: () => void) {} // `v` should be type `() => void` rather than `UnwrappedObject`. output(function() {}).apply(v => sentinel(v)); - })); + }); }); it("handles all in one", test( diff --git a/sdk/nodejs/tests/util.ts b/sdk/nodejs/tests/util.ts index 713377383fad..7c592b1bf93c 100644 --- a/sdk/nodejs/tests/util.ts +++ b/sdk/nodejs/tests/util.ts @@ -1,4 +1,4 @@ -// Copyright 2016-2018, Pulumi Corporation. +// Copyright 2016-2022, Pulumi Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,12 +14,17 @@ import assert from "assert"; -/** @internal */ -export type MochaFunc = (err: Error) => void; +// NOTE: These helpers should no longer be used by tests. +// This module remains as part of a closure serialization test that serializes this module. + +type MochaFunc = (err: Error) => void; // A helper function for wrapping some of the boilerplate goo necessary to interface between Mocha's asynchronous // testing and our TypeScript async tests. -/** @internal */ +/** + * @internal + * @deprecated + */ export function asyncTest(test: () => Promise): (func: MochaFunc) => void { return (done: (err: any) => void) => { const go = async () => { @@ -39,7 +44,10 @@ export function asyncTest(test: () => Promise): (func: MochaFunc) => void } // A helper function for asynchronous tests that throw. -/** @internal */ +/** + * @internal + * @deprecated + */ export async function assertAsyncThrows(test: () => Promise): Promise { try { await test(); diff --git a/sdk/python/lib/pulumi/runtime/proto/resource_pb2.pyi b/sdk/python/lib/pulumi/runtime/proto/resource_pb2.pyi index e60056256d22..a2636e2f41a2 100644 --- a/sdk/python/lib/pulumi/runtime/proto/resource_pb2.pyi +++ b/sdk/python/lib/pulumi/runtime/proto/resource_pb2.pyi @@ -271,6 +271,7 @@ class RegisterResourceRequest(google.protobuf.message.Message): PLUGINDOWNLOADURL_FIELD_NUMBER: builtins.int RETAINONDELETE_FIELD_NUMBER: builtins.int ALIASES_FIELD_NUMBER: builtins.int + DELETEDWITH_FIELD_NUMBER: builtins.int type: builtins.str """the type of the object allocated.""" name: builtins.str @@ -333,6 +334,8 @@ class RegisterResourceRequest(google.protobuf.message.Message): @property def aliases(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[pulumi.alias_pb2.Alias]: """a list of additional aliases that should be considered the same.""" + deletedWith: builtins.str + """if set the engine will not call the resource providers delete method for this resource when specified resource is deleted.""" def __init__( self, *, @@ -362,9 +365,10 @@ class RegisterResourceRequest(google.protobuf.message.Message): pluginDownloadURL: builtins.str = ..., retainOnDelete: builtins.bool = ..., aliases: collections.abc.Iterable[pulumi.alias_pb2.Alias] | None = ..., + deletedWith: builtins.str = ..., ) -> None: ... def HasField(self, field_name: typing_extensions.Literal["customTimeouts", b"customTimeouts", "object", b"object"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["acceptResources", b"acceptResources", "acceptSecrets", b"acceptSecrets", "additionalSecretOutputs", b"additionalSecretOutputs", "aliasURNs", b"aliasURNs", "aliases", b"aliases", "custom", b"custom", "customTimeouts", b"customTimeouts", "deleteBeforeReplace", b"deleteBeforeReplace", "deleteBeforeReplaceDefined", b"deleteBeforeReplaceDefined", "dependencies", b"dependencies", "ignoreChanges", b"ignoreChanges", "importId", b"importId", "name", b"name", "object", b"object", "parent", b"parent", "pluginDownloadURL", b"pluginDownloadURL", "propertyDependencies", b"propertyDependencies", "protect", b"protect", "provider", b"provider", "providers", b"providers", "remote", b"remote", "replaceOnChanges", b"replaceOnChanges", "retainOnDelete", b"retainOnDelete", "supportsPartialValues", b"supportsPartialValues", "type", b"type", "version", b"version"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["acceptResources", b"acceptResources", "acceptSecrets", b"acceptSecrets", "additionalSecretOutputs", b"additionalSecretOutputs", "aliasURNs", b"aliasURNs", "aliases", b"aliases", "custom", b"custom", "customTimeouts", b"customTimeouts", "deleteBeforeReplace", b"deleteBeforeReplace", "deleteBeforeReplaceDefined", b"deleteBeforeReplaceDefined", "deletedWith", b"deletedWith", "dependencies", b"dependencies", "ignoreChanges", b"ignoreChanges", "importId", b"importId", "name", b"name", "object", b"object", "parent", b"parent", "pluginDownloadURL", b"pluginDownloadURL", "propertyDependencies", b"propertyDependencies", "protect", b"protect", "provider", b"provider", "providers", b"providers", "remote", b"remote", "replaceOnChanges", b"replaceOnChanges", "retainOnDelete", b"retainOnDelete", "supportsPartialValues", b"supportsPartialValues", "type", b"type", "version", b"version"]) -> None: ... global___RegisterResourceRequest = RegisterResourceRequest