pulumi/tests
Sean Gillespie 1a1ba03925 Add per-resource states
Fixes pulumi/pulumi#1626. This commit obviates the need to invalidate
and re-validate snapshots as they are mutated, which in turn allows for
correctness when there are multiple snapshot mutations active at a time.

The crux of this commit is that the SnapshotManager will, at the start
of a mutating operation, write the resource into the snapshot before the
operation has begun, but with a non-empty "status". At the end of the
operation, the SnapshotManager will (depending on the outcome of the
step) remove the "status" field. The general idea here is that a
resource will have a non-empty "status" field if there is a resource
operation currently in-flight.

The precise semantics here are different for each kind of step:

* `CreateStep` - SnapshotManager inserts a new node into the snapshot
containing the inputs of the resource being created. This node has
status "creating". If the step succeeds, the "status" field is cleared.
If the step fails, the entire resource is removed from the snapshot.

* `UpdateStep` - SnapshotManager inserts a new node into the snapshot
containing the inputs of the resource being updated. This node has
status "updating". If the step succeeds, the "status" field is cleared
on the new resource and the old resource is removed from the snapshot.
If the tep fails, the entire new resource is removed from the snapshot.

* `ReadStep` - SnapshotManager inserts a new node into the snapshot
containing the search inputs to `read`. This node has status "reading".
If the step succeeds, the existing resource being read over is removed
(if one exists) and the new resource's "status" field is cleared. If the
step fails, the entire new resource is removed from the snapshot.

* `DeleteStep` - SnapshotManager sets the "status" field of the resource
being deleted to "deleting". If the step suceeds, the resource is
removed from the snapshot. If the step fails, the resource's "status"
field is cleared.

As part of this commit, the engine will reject any snapshot that has a
resource within it with the "status" field set. Running "pulumi stack
import" on a stack with invalid resources in it will remove those
resources from the snapshot.
2018-08-08 15:53:24 -07:00
..
integration Merge pull request #1698 from pulumi/ellismg/fix-1581 2018-08-08 14:16:20 -07:00
main_test.go Require `pulumi login` before commands that need a backend 2018-04-05 10:19:41 -07:00
new_test.go Add optional `--dir` flag to `pulumi new` (#1459) 2018-06-04 13:33:58 -07:00
stack_test.go Add per-resource states 2018-08-08 15:53:24 -07:00