pulumi/tests/integration/steps
Pat Gavlin 1ecdc83a33 Implement more precise delete-before-replace semantics. (#2369)
This implements the new algorithm for deciding which resources must be
deleted due to a delete-before-replace operation.

We need to compute the set of resources that may be replaced by a
change to the resource under consideration. We do this by taking the
complete set of transitive dependents on the resource under
consideration and removing any resources that would not be replaced by
changes to their dependencies. We determine whether or not a resource
may be replaced by substituting unknowns for input properties that may
change due to deletion of the resources their value depends on and
calling the resource provider's Diff method.

This is perhaps clearer when described by example. Consider the
following dependency graph:

  A
__|__
B   C
|  _|_
D  E F

In this graph, all of B, C, D, E, and F transitively depend on A. It may
be the case, however, that changes to the specific properties of any of
those resources R that would occur if a resource on the path to A were
deleted and recreated may not cause R to be replaced. For example, the
edge from B to A may be a simple dependsOn edge such that a change to
B does not actually influence any of B's input properties. In that case,
neither B nor D would need to be deleted before A could be deleted.

In order to make the above algorithm a reality, the resource monitor
interface has been updated to include a map that associates an input
property key with the list of resources that input property depends on.
Older clients of the resource monitor will leave this map empty, in
which case all input properties will be treated as depending on all
dependencies of the resource. This is probably overly conservative, but
it is less conservative than what we currently implement, and is
certainly correct.
2019-01-28 09:46:30 -08:00
..
step1 Remove existing lock files 2018-11-12 15:33:58 -08:00
step2 Update the copyright end date to 2018. (#1068) 2018-03-21 12:43:21 -07:00
step3 Update the copyright end date to 2018. (#1068) 2018-03-21 12:43:21 -07:00
step4 Update the copyright end date to 2018. (#1068) 2018-03-21 12:43:21 -07:00
step5 Update the copyright end date to 2018. (#1068) 2018-03-21 12:43:21 -07:00
step6 Update the copyright end date to 2018. (#1068) 2018-03-21 12:43:21 -07:00
README.md Tweak readme. (#1505) 2018-06-15 13:33:51 -07:00
steps_test.go Implement more precise delete-before-replace semantics. (#2369) 2019-01-28 09:46:30 -08:00

README.md

tests/integration/steps

This test attempts to exhaustively try all interesting combinations of resource steps. This includes:

  • Same
  • Create
  • Update
  • Delete
  • CreateReplacement
  • DeleteReplaced

in addition to the ability to recover from failures. For example, there is a "pending deletion" capability that will remember resources that were meant to be deleted, but couldn't be, due to a failure partway through.

The test is broken into a series of steps that will be executed in order. Because the steps create different resources, we will end up with a specific sequence of CRUD operations that we will validate.

Step 1

Populate the world:

  • Create 4 resources, a1, b1, c1, d1. c1 depends on a1 via an ID property.

Checkpoint: a1, b1, c1, d1

Step 2

Same, Update, Same, Delete, Create:

  • Create 1 resource, a2, equivalent to the a1 in Step 1 (Same(a1, a2)).

  • Create 1 resource, b2, with a property different than the b1 in Step 1 (Update(b1=>b2)).

  • Create 1 resource, c2, equivalent to the c1 in Step 1 (Same(c1, c2)).

  • Elide d (Delete(d1)).

  • Create 1 resource, e2, not present in Step 1 (Create(e2)).

Checkpoint: a2, b2, c2, e2

Step 3

Replace a resource:

  • Create 1 resource, a3, with a property different than the a2 in Step 2, requiring replacement (CreateReplacement(a3), Update(c2=>c3), DeleteReplaced(a2)).

  • Elide b (Delete(b2)).

  • Create 2 resources, c3 and e3, equivalent to Step 2 (Same(c2, c3), Same(e2, e3)).

Checkpoint: a3, c3, e3

Step 4

Replace a resource (but this time, deleteBeforeReplace):

  • Create 1 resource, a4, equivalent to the a3 in Step 3 (Same(a3, a4)).

  • Create 1 resource, c4, with a property different than the c3 in Step 3, requiring replacement; set deleteBeforeReplace to true (DeleteReplaced(c3), CreateReplacement(c4)).

  • Create 1 resource, e4, equivlaent to the e3 in Step 3 (Same(e3, e4)).

Checkpoint: a4, c4, e4

Step 5

Fail during an update:

  • Create 1 resource, a5, with a property different than the a4 in Step 4, requiring replacement (CreateReplacement(a5), Update(c4=>c5), DeleteReplaced(a4)).

  • Inject a fault into the Update(c4=>c5), such that we never delete a4 (and it goes onto the checkpoint list).

Checkpoint: a5, c5, e5; pending delete: a4

Step 6

Delete everything:

  • Elide a (Delete(a5)).

  • Elide c (Delete(c)).

  • Elide e (Delete(e)).

  • Pending delete (Delete(a4)).

Checkpoint: empty