Beispiel #1
0
 def test_record_recently_converged(self):
     """
     After converging, the group is added to ``recently_converged`` -- but
     *before* being removed from ``currently_converging``, to avoid race
     conditions.
     """
     currently = Reference(pset())
     recently = Reference(pmap())
     remove_from_currently = match_func(pset([self.group_id]), pset([]))
     sequence = [
         (ReadReference(currently), lambda i: pset()),
         add_to_currently(currently, self.group_id),
         (('ec', self.tenant_id, self.group_id, 3600),
          lambda i: (StepResult.SUCCESS, ScalingGroupStatus.ACTIVE)),
         (Func(time.time), lambda i: 100),
         add_to_recently(recently, self.group_id, 100),
         (ModifyReference(currently, remove_from_currently), noop),
         (DeleteNode(path='/groups/divergent/tenant-id_g1',
                     version=self.version), noop),
         (Log('mark-clean-success', {}), noop)
     ]
     eff = converge_one_group(
         currently, recently, self.tenant_id, self.group_id, self.version,
         3600, execute_convergence=self._execute_convergence)
     perform_sequence(sequence, eff)
Beispiel #2
0
 def _verify_sequence(self, sequence, converging=Reference(pset()),
                      recent=Reference(pmap()), allow_refs=True):
     """
     Verify that sequence is executed
     """
     eff = converge_one_group(
         converging, recent, self.tenant_id, self.group_id, self.version,
         3600, execute_convergence=self._execute_convergence)
     fb_dispatcher = _get_dispatcher() if allow_refs else base_dispatcher
     perform_sequence(sequence, eff, fallback_dispatcher=fb_dispatcher)