Fix test case for operation cancellation.

Fix issue #1024