On Tue, Nov 13, 2012 at 04:02:45PM -0800, Gordon Hempton wrote:
>
> I am currently trying to create an integration test for ruote-kit and a
> worker thread. The code I would like to use is the following:
>
> wfid = subject.launch(pdef, fields)
> r = subject.wait_for('action' => 'dispatched', 'participant_name' =>
> 'review_email', 'fei.wfid' => wfid)
>
> However, this only works ~50% of the time (50% of the time it times out). I
> understand, that `wait_for` is meant to only be used by a single worker,
> but I am not sure what the best course of action is in more complex
> scenarios. I am thinking of exploring an options similar to :
>
> wfid = subject.launch(pdef, fields)
> loop do
> sleep 1
> ps = subject.ps(wfid)
> break if condition satisfied
> end
>
> But that feels pretty messy. Any ideas?
Hello Gordon,
yes, that's one way of doing it.
Another way would be to use the StorageHistory:
https://github.com/jmettraux/ruote/blob/b5b58906060ef2bedffb4f93f0587421a4e7b836/test/functional/ft_36_storage_history.rb
But you still have to poll. The event is happening in another Ruby process.
I'd recommend wrapping your polling wait_for in a spec helper, so that you
write less lines of spec.
I hope it helps, best regards,
--
John Mettraux - http://lambda.io/jmettraux
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en