2018-03-21 19:43:21 +00:00
|
|
|
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
|
2017-10-26 18:30:25 +00:00
|
|
|
|
2018-02-12 21:13:13 +00:00
|
|
|
import * as pulumi from "@pulumi/pulumi";
|
|
|
|
import * as dynamic from "@pulumi/pulumi/dynamic";
|
2017-10-26 18:30:25 +00:00
|
|
|
|
|
|
|
const sleep = require("sleep-promise");
|
|
|
|
const assert = require("assert");
|
|
|
|
|
|
|
|
class NullProvider implements dynamic.ResourceProvider {
|
2017-12-06 03:14:28 +00:00
|
|
|
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({});
|
2017-10-26 18:30:25 +00:00
|
|
|
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");
|
2018-01-19 22:17:28 +00:00
|
|
|
await sleep(1000);
|
|
|
|
const c = new NullResource("c");
|
2017-10-26 18:30:25 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
})();
|