Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Don't roll back failed test state #18

Open
JLDLaughlin opened this issue Mar 1, 2021 · 2 comments
Open

Don't roll back failed test state #18

JLDLaughlin opened this issue Mar 1, 2021 · 2 comments

Comments

@JLDLaughlin
Copy link

Hi all--first, thank you so much for this test suite! It made developing an adapter (and feeling confident about it) so much easier.

Something I found a bit challenging, though, was the fact that test failures roll back any state created during the run. In some situations, I was unable to debug without poking around the objects and data created by the test. To do so, I turned on more aggressive logging in my underlying database, recreated the test state at the time of the failure, and debugged from there.

Would you all be interested in changing this behavior? Or in providing an optional flag to preserve local state on failure?

@jtcohen6
Copy link
Contributor

jtcohen6 commented Mar 2, 2021

@JLDLaughlin Thanks so much for mettle-testing the suite, and for opening the issue! You're right—it's frustrating to have lots of past test schemas cluttering up the db, and it's also frustrating to have those test schemas aggressively cleared when they'd be the best first stop for debugging.

I believe there already exists an optional --no-drop-schema flag that, when passed, tells the test suite not to drop the schema:
https://github.com/fishtown-analytics/dbt-adapter-tests/blob/a411336e9493a38c228a876e19af24d70ec53d86/pytest_dbt_adapter/__init__.py#L13-L15

https://github.com/fishtown-analytics/dbt-adapter-tests/blob/a411336e9493a38c228a876e19af24d70ec53d86/pytest_dbt_adapter/spec_file.py#L659-L662

Would you be able to give that a go and see if it works as intended? If so, we should definitely document it in the README.

On top of that, I'm thinking about a -x/--fail-fast flag that would stop the testing suite at first sign of failure, and leave the database objects in place. Is that something you would have found helpful during adapter development?

@JLDLaughlin
Copy link
Author

Awesome! The --no-drop-schema is exactly what I wanted, we'll try it out and report back here.

Also, -x/--fail-fast would be great addition! I also did this manually by commenting out tests in our .spec file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants