@pulumi/pulumi 3.135.2-alpha.x8a349a5 → 3.135.2-alpha.xcc59acd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/runtime/invoke.js +22 -7
- package/runtime/invoke.js.map +1 -1
- package/runtime/rpc.js +49 -10
- package/runtime/rpc.js.map +1 -1
- package/version.js +1 -1
- package/npm/testdata/nested/project/index.d.ts +0 -0
- package/npm/testdata/nested/project/index.js +0 -16
- package/npm/testdata/nested/project/index.js.map +0 -1
- package/tests/automation/cmd.spec.d.ts +0 -1
- package/tests/automation/cmd.spec.js +0 -186
- package/tests/automation/cmd.spec.js.map +0 -1
- package/tests/automation/data/correct_project/Pulumi.yaml +0 -3
- package/tests/automation/data/import/Pulumi.yaml +0 -2
- package/tests/automation/data/import/expected_generated_code.txt +0 -11
- package/tests/automation/data/json/Pulumi.dev.json +0 -9
- package/tests/automation/data/json/Pulumi.json +0 -5
- package/tests/automation/data/nested_config/Pulumi.dev.yaml +0 -11
- package/tests/automation/data/nested_config/Pulumi.yaml +0 -3
- package/tests/automation/data/tcfg/Pulumi.yaml +0 -4
- package/tests/automation/data/tcfg/index.ts +0 -1
- package/tests/automation/data/tcfg/package-lock.json +0 -3062
- package/tests/automation/data/tcfg/package.json +0 -9
- package/tests/automation/data/tcfg/tsconfig.json +0 -16
- package/tests/automation/data/testproj/Pulumi.yaml +0 -3
- package/tests/automation/data/testproj/go.mod +0 -71
- package/tests/automation/data/testproj/go.sum +0 -299
- package/tests/automation/data/testproj/main.go +0 -19
- package/tests/automation/data/testproj_dotnet/Program.cs +0 -12
- package/tests/automation/data/testproj_dotnet/Pulumi.yaml +0 -3
- package/tests/automation/data/testproj_dotnet/TestProj.csproj +0 -12
- package/tests/automation/data/yaml/Pulumi.dev.yaml +0 -5
- package/tests/automation/data/yaml/Pulumi.yaml +0 -3
- package/tests/automation/data/yml/Pulumi.dev.yml +0 -5
- package/tests/automation/data/yml/Pulumi.yml +0 -3
- package/tests/automation/localWorkspace.spec.d.ts +0 -1
- package/tests/automation/localWorkspace.spec.js +0 -1325
- package/tests/automation/localWorkspace.spec.js.map +0 -1
- package/tests/automation/remoteWorkspace.spec.d.ts +0 -1
- package/tests/automation/remoteWorkspace.spec.js +0 -460
- package/tests/automation/remoteWorkspace.spec.js.map +0 -1
- package/tests/automation/util.d.ts +0 -1
- package/tests/automation/util.js +0 -31
- package/tests/automation/util.js.map +0 -1
- package/tests/config.spec.d.ts +0 -1
- package/tests/config.spec.js +0 -177
- package/tests/config.spec.js.map +0 -1
- package/tests/constants.d.ts +0 -1
- package/tests/constants.js +0 -18
- package/tests/constants.js.map +0 -1
- package/tests/init.spec.d.ts +0 -1
- package/tests/init.spec.js +0 -18
- package/tests/init.spec.js.map +0 -1
- package/tests/iterable.spec.d.ts +0 -1
- package/tests/iterable.spec.js +0 -60
- package/tests/iterable.spec.js.map +0 -1
- package/tests/options.spec.d.ts +0 -1
- package/tests/options.spec.js +0 -233
- package/tests/options.spec.js.map +0 -1
- package/tests/output.spec.d.ts +0 -1
- package/tests/output.spec.js +0 -809
- package/tests/output.spec.js.map +0 -1
- package/tests/provider.spec.d.ts +0 -1
- package/tests/provider.spec.js +0 -524
- package/tests/provider.spec.js.map +0 -1
- package/tests/resource.spec.d.ts +0 -1
- package/tests/resource.spec.js +0 -275
- package/tests/resource.spec.js.map +0 -1
- package/tests/runtime/asyncIterableUtil.spec.d.ts +0 -1
- package/tests/runtime/asyncIterableUtil.spec.js +0 -115
- package/tests/runtime/asyncIterableUtil.spec.js.map +0 -1
- package/tests/runtime/closure-integration-tests.d.ts +0 -1
- package/tests/runtime/closure-integration-tests.js +0 -120
- package/tests/runtime/closure-integration-tests.js.map +0 -1
- package/tests/runtime/findWorkspaceRoot.spec.d.ts +0 -1
- package/tests/runtime/findWorkspaceRoot.spec.js +0 -62
- package/tests/runtime/findWorkspaceRoot.spec.js.map +0 -1
- package/tests/runtime/install-package-tests.d.ts +0 -1
- package/tests/runtime/install-package-tests.js +0 -230
- package/tests/runtime/install-package-tests.js.map +0 -1
- package/tests/runtime/langhost/cases/000.empty/index.js +0 -1
- package/tests/runtime/langhost/cases/001.one_resource/index.js +0 -11
- package/tests/runtime/langhost/cases/002.ten_resources/index.js +0 -13
- package/tests/runtime/langhost/cases/003.one_complex_resource/index.js +0 -77
- package/tests/runtime/langhost/cases/004.ten_complex_resources/index.js +0 -38
- package/tests/runtime/langhost/cases/004.ten_complex_resources/resource.js +0 -30
- package/tests/runtime/langhost/cases/005.resource_thens/index.js +0 -72
- package/tests/runtime/langhost/cases/006.asset/index.js +0 -13
- package/tests/runtime/langhost/cases/006.asset/testdata.txt +0 -4
- package/tests/runtime/langhost/cases/007.promises_io/index.js +0 -25
- package/tests/runtime/langhost/cases/007.promises_io/testdata.txt +0 -4
- package/tests/runtime/langhost/cases/008.ten_depends_on_resources/index.js +0 -46
- package/tests/runtime/langhost/cases/009.invoke/index.js +0 -25
- package/tests/runtime/langhost/cases/010.runtime_settings/index.js +0 -22
- package/tests/runtime/langhost/cases/011.unhandled_error/index.js +0 -1
- package/tests/runtime/langhost/cases/012.assets_archive/index.js +0 -25
- package/tests/runtime/langhost/cases/013.unhandled_promise_rejection/index.js +0 -3
- package/tests/runtime/langhost/cases/014.read_resource/index.js +0 -19
- package/tests/runtime/langhost/cases/015.runtime_sxs/index.js +0 -100
- package/tests/runtime/langhost/cases/016.promise_leak/index.js +0 -3
- package/tests/runtime/langhost/cases/017.parent_defaults/index.js +0 -89
- package/tests/runtime/langhost/cases/018.logging/index.js +0 -15
- package/tests/runtime/langhost/cases/019.stack_exports/index.js +0 -15
- package/tests/runtime/langhost/cases/020.property_dependencies/index.js +0 -39
- package/tests/runtime/langhost/cases/021.parent_child_dependencies/index.js +0 -15
- package/tests/runtime/langhost/cases/022.parent_child_dependencies_2/index.js +0 -16
- package/tests/runtime/langhost/cases/023.parent_child_dependencies_3/index.js +0 -28
- package/tests/runtime/langhost/cases/024.parent_child_dependencies_4/index.js +0 -22
- package/tests/runtime/langhost/cases/025.parent_child_dependencies_5/index.js +0 -24
- package/tests/runtime/langhost/cases/026.parent_child_dependencies_6/index.js +0 -29
- package/tests/runtime/langhost/cases/027.parent_child_dependencies_7/index.js +0 -36
- package/tests/runtime/langhost/cases/028.parent_child_dependencies_8/index.js +0 -28
- package/tests/runtime/langhost/cases/029.parent_child_dependencies_9/index.js +0 -23
- package/tests/runtime/langhost/cases/030.import_resource/index.js +0 -11
- package/tests/runtime/langhost/cases/040.run_error/index.js +0 -3
- package/tests/runtime/langhost/cases/041.component_opt_single_provider/index.js +0 -89
- package/tests/runtime/langhost/cases/042.component_opt_providers_array/index.js +0 -89
- package/tests/runtime/langhost/cases/043.depends_on_non_resource/index.js +0 -11
- package/tests/runtime/langhost/cases/044.versions/index.js +0 -22
- package/tests/runtime/langhost/cases/045.ignore_changes/index.js +0 -11
- package/tests/runtime/langhost/cases/046.recursive_stack_exports/index.js +0 -19
- package/tests/runtime/langhost/cases/047.exported_function/index.js +0 -13
- package/tests/runtime/langhost/cases/048.exported_promise_function/index.js +0 -13
- package/tests/runtime/langhost/cases/049.exported_async_function/index.js +0 -13
- package/tests/runtime/langhost/cases/050.resource_creation_in_function/index.js +0 -11
- package/tests/runtime/langhost/cases/051.resource_creation_in_function_with_result/index.js +0 -12
- package/tests/runtime/langhost/cases/052.resource_creation_in_async_function_with_result/index.js +0 -12
- package/tests/runtime/langhost/cases/060.provider_invokes/index.js +0 -26
- package/tests/runtime/langhost/cases/061.provider_in_parent_invokes/index.js +0 -33
- package/tests/runtime/langhost/cases/062.providerref_invokes/index.js +0 -33
- package/tests/runtime/langhost/cases/063.providerref_in_parent_invokes/index.js +0 -41
- package/tests/runtime/langhost/cases/064.async_components/index.js +0 -44
- package/tests/runtime/langhost/cases/065.large_resource/index.js +0 -17
- package/tests/runtime/langhost/cases/066.replace_on_changes/index.js +0 -11
- package/tests/runtime/langhost/cases/067.native_es_module/index.js +0 -11
- package/tests/runtime/langhost/cases/067.native_es_module/package.json +0 -1
- package/tests/runtime/langhost/cases/068.remote_component_providers/index.js +0 -34
- package/tests/runtime/langhost/cases/068.remote_component_providers/package.json +0 -3
- package/tests/runtime/langhost/cases/069.ambiguous_entrypoints/index.d.ts +0 -1
- package/tests/runtime/langhost/cases/069.ambiguous_entrypoints/index.js +0 -11
- package/tests/runtime/langhost/cases/069.ambiguous_entrypoints/index.js.map +0 -1
- package/tests/runtime/langhost/cases/069.ambiguous_entrypoints/index.ts +0 -23
- package/tests/runtime/langhost/cases/070.unusual_alias_names/index.js +0 -26
- package/tests/runtime/langhost/cases/071.large_alias_counts/index.js +0 -22
- package/tests/runtime/langhost/cases/072.large_alias_lineage_chains/index.js +0 -55
- package/tests/runtime/langhost/cases/073.component_dependencies/index.js +0 -28
- package/tests/runtime/langhost/cases/074.source_position/index.js +0 -17
- package/tests/runtime/langhost/run.spec.d.ts +0 -1
- package/tests/runtime/langhost/run.spec.js +0 -1685
- package/tests/runtime/langhost/run.spec.js.map +0 -1
- package/tests/runtime/pack.d.ts +0 -1
- package/tests/runtime/pack.js +0 -56
- package/tests/runtime/pack.js.map +0 -1
- package/tests/runtime/props.spec.d.ts +0 -1
- package/tests/runtime/props.spec.js +0 -387
- package/tests/runtime/props.spec.js.map +0 -1
- package/tests/runtime/registrations.spec.d.ts +0 -1
- package/tests/runtime/registrations.spec.js +0 -139
- package/tests/runtime/registrations.spec.js.map +0 -1
- package/tests/runtime/settings.spec.d.ts +0 -1
- package/tests/runtime/settings.spec.js +0 -57
- package/tests/runtime/settings.spec.js.map +0 -1
- package/tests/runtime/testdata/nested/project/index.d.ts +0 -0
- package/tests/runtime/testdata/nested/project/index.js +0 -16
- package/tests/runtime/testdata/nested/project/index.js.map +0 -1
- package/tests/stackReference.spec.d.ts +0 -1
- package/tests/stackReference.spec.js +0 -86
- package/tests/stackReference.spec.js.map +0 -1
- package/tests/unwrap.spec.d.ts +0 -1
- package/tests/unwrap.spec.js +0 -254
- package/tests/unwrap.spec.js.map +0 -1
- package/tests/util.d.ts +0 -1
- package/tests/util.js +0 -71
- package/tests/util.js.map +0 -1
- package/tests_with_mocks/mocks.spec.d.ts +0 -1
- package/tests_with_mocks/mocks.spec.js +0 -182
- package/tests_with_mocks/mocks.spec.js.map +0 -1
package/tests/util.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2016-2022, Pulumi Corporation.
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
const assert_1 = __importDefault(require("assert"));
|
|
29
|
-
// A helper function for wrapping some of the boilerplate goo necessary to interface between Mocha's asynchronous
|
|
30
|
-
// testing and our TypeScript async tests.
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
* @deprecated
|
|
34
|
-
*/
|
|
35
|
-
function asyncTest(test) {
|
|
36
|
-
return (done) => {
|
|
37
|
-
const go = () => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
let caught;
|
|
39
|
-
try {
|
|
40
|
-
yield test();
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
caught = err;
|
|
44
|
-
}
|
|
45
|
-
finally {
|
|
46
|
-
done(caught);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
go();
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
exports.asyncTest = asyncTest;
|
|
53
|
-
// A helper function for asynchronous tests that throw.
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
* @deprecated
|
|
57
|
-
*/
|
|
58
|
-
function assertAsyncThrows(test) {
|
|
59
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
try {
|
|
61
|
-
yield test();
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
return err.message;
|
|
65
|
-
}
|
|
66
|
-
assert_1.default(false, "Function was expected to throw, but didn't");
|
|
67
|
-
return "";
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
exports.assertAsyncThrows = assertAsyncThrows;
|
|
71
|
-
//# sourceMappingURL=util.js.map
|
package/tests/util.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../tests/util.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;;;;;;;;;;;;AAEjC,oDAA4B;AAO5B,iHAAiH;AACjH,0CAA0C;AAC1C;;;GAGG;AACH,SAAgB,SAAS,CAAC,IAAyB;IAC/C,OAAO,CAAC,IAAwB,EAAE,EAAE;QAChC,MAAM,EAAE,GAAG,GAAS,EAAE;YAClB,IAAI,MAAyB,CAAC;YAC9B,IAAI;gBACA,MAAM,IAAI,EAAE,CAAC;aAChB;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,GAAG,GAAG,CAAC;aAChB;oBAAS;gBACN,IAAI,CAAC,MAAM,CAAC,CAAC;aAChB;QACL,CAAC,CAAA,CAAC;QACF,EAAE,EAAE,CAAC;IACT,CAAC,CAAC;AACN,CAAC;AAdD,8BAcC;AAED,uDAAuD;AACvD;;;GAGG;AACH,SAAsB,iBAAiB,CAAC,IAAyB;;QAC7D,IAAI;YACA,MAAM,IAAI,EAAE,CAAC;SAChB;QAAC,OAAO,GAAG,EAAE;YACV,OAAO,GAAG,CAAC,OAAO,CAAC;SACtB;QAED,gBAAM,CAAC,KAAK,EAAE,4CAA4C,CAAC,CAAC;QAC5D,OAAO,EAAE,CAAC;IACd,CAAC;CAAA;AATD,8CASC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2016-2018, Pulumi Corporation.
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
28
|
-
result["default"] = mod;
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
const assert = __importStar(require("assert"));
|
|
33
|
-
const pulumi = __importStar(require("../index"));
|
|
34
|
-
const callMock = (args) => {
|
|
35
|
-
switch (args.token) {
|
|
36
|
-
case "test:index:MyFunction":
|
|
37
|
-
return { out_value: 59 };
|
|
38
|
-
default:
|
|
39
|
-
return {};
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const asyncCallMock = (args) => Promise.resolve(callMock(args));
|
|
43
|
-
const newResourceMock = (args) => {
|
|
44
|
-
switch (args.type) {
|
|
45
|
-
case "aws:ec2/instance:Instance":
|
|
46
|
-
assert.strictEqual(args.custom, true);
|
|
47
|
-
const state = {
|
|
48
|
-
arn: "arn:aws:ec2:us-west-2:123456789012:instance/i-1234567890abcdef0",
|
|
49
|
-
instanceState: "running",
|
|
50
|
-
primaryNetworkInterfaceId: "eni-12345678",
|
|
51
|
-
privateDns: "ip-10-0-1-17.ec2.internal",
|
|
52
|
-
publicDns: "ec2-203-0-113-12.compute-1.amazonaws.com",
|
|
53
|
-
publicIP: "203.0.113.12",
|
|
54
|
-
};
|
|
55
|
-
return { id: "i-1234567890abcdef0", state: Object.assign(Object.assign({}, args.inputs), state) };
|
|
56
|
-
case "pkg:index:MyCustom":
|
|
57
|
-
assert.strictEqual(args.custom, true);
|
|
58
|
-
return { id: args.name + "_id", state: args.inputs };
|
|
59
|
-
case "pkg:index:MyRemoteComponent":
|
|
60
|
-
return {
|
|
61
|
-
id: `${args.name}_id`,
|
|
62
|
-
state: Object.assign(Object.assign({}, args.inputs), { outprop: `output: ${args.inputs["inprop"]}` }),
|
|
63
|
-
};
|
|
64
|
-
default:
|
|
65
|
-
assert.strictEqual(args.custom, false);
|
|
66
|
-
return { id: "", state: {} };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const asyncNewResourceMock = (args) => Promise.resolve(newResourceMock(args));
|
|
70
|
-
class MyComponent extends pulumi.ComponentResource {
|
|
71
|
-
constructor(name, inprop, opts) {
|
|
72
|
-
super("pkg:index:MyComponent", name, {}, opts);
|
|
73
|
-
this.outprop = pulumi.output(inprop).apply((x) => `output: ${x}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
class MyRemoteComponent extends pulumi.ComponentResource {
|
|
77
|
-
constructor(name, inprop, opts) {
|
|
78
|
-
super("pkg:index:MyRemoteComponent", name, { inprop, outprop: undefined }, opts, true);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
class Instance extends pulumi.CustomResource {
|
|
82
|
-
constructor(name, opts) {
|
|
83
|
-
const props = { publicIP: undefined };
|
|
84
|
-
super("aws:ec2/instance:Instance", name, props, opts);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
class MyCustom extends pulumi.CustomResource {
|
|
88
|
-
constructor(name, props, opts) {
|
|
89
|
-
super("pkg:index:MyCustom", name, props, opts);
|
|
90
|
-
}
|
|
91
|
-
static get(name, id, state, opts) {
|
|
92
|
-
return new MyCustom(name, state, Object.assign(Object.assign({}, opts), { id }));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function invoke() {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
const value = yield pulumi.runtime.invoke("test:index:MyFunction", { value: 41 });
|
|
98
|
-
return value["out_value"];
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
const setups = [
|
|
102
|
-
["mocks: newResource sync, call sync", false, false],
|
|
103
|
-
["mocks: newResource sync, call async", false, true],
|
|
104
|
-
["mocks: newResource async, call sync", true, false],
|
|
105
|
-
["mocks: newResource async, call async", true, true],
|
|
106
|
-
];
|
|
107
|
-
setups.forEach(([test, isAsyncNewResource, isAsyncCall]) => {
|
|
108
|
-
describe(test, function () {
|
|
109
|
-
let component;
|
|
110
|
-
let instance;
|
|
111
|
-
let custom;
|
|
112
|
-
let read;
|
|
113
|
-
let invokeResult;
|
|
114
|
-
let remoteComponent;
|
|
115
|
-
before(() => {
|
|
116
|
-
pulumi.runtime.setMocks({
|
|
117
|
-
call: isAsyncCall ? asyncCallMock : callMock,
|
|
118
|
-
newResource: isAsyncNewResource ? asyncNewResourceMock : newResourceMock,
|
|
119
|
-
});
|
|
120
|
-
pulumi.runtime.registerResourceModule("aws", "ec2/instance", {
|
|
121
|
-
construct: (name, type, urn) => {
|
|
122
|
-
switch (type) {
|
|
123
|
-
case "aws:ec2/instance:Instance":
|
|
124
|
-
return new Instance(name, { urn });
|
|
125
|
-
default:
|
|
126
|
-
throw new Error(`unknown resource type ${type}`);
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
component = new MyComponent("mycomponent", "hello");
|
|
131
|
-
instance = new Instance("instance");
|
|
132
|
-
custom = new MyCustom("mycustom", { instance: instance });
|
|
133
|
-
read = MyCustom.get("mycustom", "read");
|
|
134
|
-
invokeResult = invoke();
|
|
135
|
-
remoteComponent = new MyRemoteComponent("myremotecomponent", pulumi.interpolate `hello: ${instance.id}`);
|
|
136
|
-
});
|
|
137
|
-
describe("component", function () {
|
|
138
|
-
it("has expected output value", (done) => {
|
|
139
|
-
component.outprop.apply((outprop) => {
|
|
140
|
-
assert.strictEqual(outprop, "output: hello");
|
|
141
|
-
done();
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
describe("remote component", function () {
|
|
146
|
-
it("has expected output value", (done) => {
|
|
147
|
-
remoteComponent.outprop.apply((outprop) => {
|
|
148
|
-
assert.strictEqual(outprop.startsWith("output: hello: "), true);
|
|
149
|
-
done();
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
describe("custom", function () {
|
|
154
|
-
it("instance has expected output value", (done) => {
|
|
155
|
-
instance.publicIP.apply((ip) => {
|
|
156
|
-
assert.strictEqual(ip, "203.0.113.12");
|
|
157
|
-
done();
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
it("mycustom has expected output value", (done) => {
|
|
161
|
-
custom.instance.apply((_) => {
|
|
162
|
-
done();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
it("can be read with get", (done) => {
|
|
166
|
-
read.id.apply((id) => {
|
|
167
|
-
assert.strictEqual(id, "read");
|
|
168
|
-
done();
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
describe("invoke", function () {
|
|
173
|
-
it("has expected result", (done) => {
|
|
174
|
-
invokeResult.then((value) => {
|
|
175
|
-
assert.strictEqual(value, 59);
|
|
176
|
-
done();
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
//# sourceMappingURL=mocks.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.spec.js","sourceRoot":"","sources":["../../tests_with_mocks/mocks.spec.ts"],"names":[],"mappings":";AAAA,2CAA2C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