dbcli / mssql-cli

A command-line client for SQL Server with auto-completion and syntax highlighting
BSD 3-Clause "New" or "Revised" License
1.36k stars 191 forks source link

Stabilized db create for tests #441

Closed ellbosch closed 4 years ago

ellbosch commented 4 years ago

Closes #280.

This PR introduces retry logic to check the status of a db creation using sys.dm_operation_status.

ellbosch commented 4 years ago

@pensivebrian I've made the suggested changes, please let me know your thoughts.

We still need to fix the known issue in the Special module but I can submit that in a separate PR.

ellbosch commented 4 years ago

I just added another commit to improve reliability of our tests:

ellbosch commented 4 years ago

Another change today to improve DB create reliability and code quality:

ellbosch commented 4 years ago

I think the PR is becoming too complicated. I can tell what's stabilization and what is pytest migration. Can we just fix the create database issue, an address pytest some other time?

I can simplify this a bit—unfortunately, most of the code changes were about ensuring tests can run off of the master DB (which because a requirement now that we call sys.dm_operation_status).

However, I did refactor things a little in test_special.py, which I can save for another day 🙂

ellbosch commented 4 years ago

@pensivebrian I made a small tweak to our helper method to return an error message with the state response in the form of a tuple.