It was possiblef for the finally for a stack to complete before all other resources had been created. In this case, we would put these new resources at top level, instead of having them as children of the stack resource. Since we do not use the langhost across stacks, we can simply set the stack resource at top level and never remove it. Fixes #818
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
|
|
|
import * as pulumi from "pulumi";
|
|
import * as dynamic from "pulumi/dynamic";
|
|
|
|
const sleep = require("sleep-promise");
|
|
const assert = require("assert");
|
|
|
|
class NullProvider implements dynamic.ResourceProvider {
|
|
check = (olds: any, news: any) => Promise.resolve({ inputs: news });
|
|
diff = (id: pulumi.ID, olds: any, news: any) => Promise.resolve({});
|
|
create = (inputs: any) => Promise.resolve({ id: "0" });
|
|
update = (id: string, olds: any, news: any) => Promise.resolve({});
|
|
delete = (id: pulumi.ID, props: any) => Promise.resolve();
|
|
}
|
|
|
|
class NullResource extends dynamic.Resource {
|
|
constructor(name: string) {
|
|
super(new NullProvider(), name, {}, undefined);
|
|
}
|
|
}
|
|
|
|
(async () => {
|
|
try {
|
|
const a = new NullResource("a");
|
|
await sleep(1000);
|
|
const b = new NullResource("b");
|
|
await sleep(1000);
|
|
const c = new NullResource("c");
|
|
const urn = await b.urn;
|
|
assert.notStrictEqual(urn, undefined, "expected a defined urn");
|
|
assert.notStrictEqual(urn, "", "expected a valid urn");
|
|
} catch (err) {
|
|
console.error(err);
|
|
process.exit(-1);
|
|
}
|
|
})();
|