pulumi/tests/integration/stack_parenting/index.ts
Joe Duffy 971f6189f2
Fix pending delete replacement failure (#658)
The two-phase output properties change broke the ability to recover
from a failed replacement that yields pending deletes in the checkpoint.
The issue here is simply that we should remember pending registrations
only for logical operations that *also* have a "new" state (create or
update).  This commit fixes this, and also adds a new step test with
fault injection to probe many interesting combinations of steps.
2017-12-07 09:44:38 -08:00

49 lines
1.2 KiB
TypeScript

// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
import * as pulumi from "pulumi";
let currentID = 0;
class Provider implements pulumi.dynamic.ResourceProvider {
public static instance = new Provider();
public create: (inputs: any) => Promise<pulumi.dynamic.CreateResult>;
constructor() {
this.create = async (inputs: any) => {
return {
id: (currentID++).toString(),
outs: undefined,
};
};
}
}
class Resource extends pulumi.dynamic.Resource {
constructor(name: string, parent?: pulumi.Resource) {
super(Provider.instance, name, {}, parent, undefined);
}
}
// Just allocate a few resources and make sure their URNs are correct with respect to parents, etc. This
// should form a tree of roughly the following structure:
//
// A F
// / \ \
// B C G
// / \
// D E
//
// with the caveat, of course, that A and F will share a common parent, the implicit stack.
let a = new Resource("a");
let b = new Resource("b", a);
let c = new Resource("c", a);
let d = new Resource("d", c);
let e = new Resource("e", c);
let f = new Resource("f");
let g = new Resource("g", f);