Add failing integration test to expose bug #1005

This is a failing integration test case for the scenario described in issue #1005.