1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Fix broken deploy_failure.feature tests

It seems that enhancing a task using an `after` block will not have desired
effect if the new task shares the same name (excluding namespace) as the task
being enhanced. In other words, `after 'deploy:failed', :failed do ...` will
not work (the block will never be executed). This behavior was recently
introduced in 5fcf3da.

To fix the feature test using this code, I renamed the task to be a unique name.
The test now works as intended.

Also, I noticed the task defined in `fail.rake` was sometimes not working as
intended, because the `shared_path` did not exist on the VM's filesystem. This
meant that `touch` was failing. Corrected by issuing `mkdir -p` first.

With these changes, all feature tests now pass.
This commit is contained in:
Matt Brictson 2015-12-27 16:49:31 -08:00
parent 41179c408e
commit 5ecd2085bd
2 changed files with 2 additions and 1 deletions

View file

@ -1,6 +1,7 @@
set :fail, proc { fail }
before 'deploy:starting', :fail do
on roles :all do
execute :mkdir, '-p', shared_path
execute :touch, shared_path.join('fail')
end
fetch(:fail)

View file

@ -1,4 +1,4 @@
after 'deploy:failed', :failed do
after 'deploy:failed', :custom_failed do
on roles :all do
execute :touch, shared_path.join('failed')
end