How do I simulate transient errors with Azure Database?

azure, azure-sql-database, error-handling, throttling

Solution

Look at combining Testing Transient errors in Azure and the list of error codes returned by Windows Azure SQL Database, and see if you can mock in the behavior that you are testing. Beyond unit testing I don't think that you are going to be able to 'simulate' errors because these errors are coming from SQL via the TDS protocol, which will be difficult to intercept. Your need would be a good candidate for a fork of the application block where you could inject a simulator.

Problem

I am working with the Transient Fault Handling Application Block (TFHAB) to define a retry policy when interfacing with an Azure Database. I'm wondering if there is a way to invoke a throttling response in order to plan and handle likely production scenarios? I could place an SQL command in a loop and run it until I invoke a response however presumably this is not considered to be "best practice"? Can anyone suggest some practical ways in which I can test my transient error handling logic?

Original source