-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor post deploy hooks to use sql facade and clean up tests with factories #1804
base: main
Are you sure you want to change the base?
Conversation
if run_post_deploy_hooks: | ||
self.execute_post_deploy_hooks() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this will be calling use_role through the sql facade, we don't need to nest it inside the above context manager
@mock.patch(MOCK_CONNECTION_DB, new_callable=mock.PropertyMock) | ||
@mock.patch(MOCK_CONNECTION_WH, new_callable=mock.PropertyMock) | ||
@mock.patch.dict(os.environ, {"USER": "test_user"}) | ||
def test_sql_scripts_with_no_warehouse_no_database( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to pass the role/warehouse to the sql facade in execute_post_deploy_hooks so that it wasn't dependent on previous calls to use_role/warehouse by the executor, which makes this test invalid with the new setup
app_role = (model.meta and model.meta.role) or workspace_ctx.default_role | ||
app_warehouse = ( | ||
model.meta and model.meta.warehouse | ||
) or workspace_ctx.default_warehouse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should rebase on top of Frank's latest work (expect conflicts though, but it will make your job easier overall)
Pre-review checklist
Changes description