1. 1
  1.  

  2. 3

    This is the same basic idea that we did at a previous company I worked at, we called them “reversible operations”, or “revops”. The added bit we had was that you could do:

    testcase = run_in_revop([revop1, revop2, ...], test) and it would make a testcase called testcase which was a test called test and wrap it up in the revops and pass in the state of the revops. It also took care of making sure if a revop failed to initialize, the other revops that had successfully initialized were torn down. It is really awesome and great for testcases.