From 51c7ac684fb3f1b07dd821bf441b0bea41bb3b87 Mon Sep 17 00:00:00 2001 From: Tomasz Urbaszek Date: Thu, 1 Feb 2024 13:09:27 +0100 Subject: [PATCH] Update int tests setup with setup script --- CONTRIBUTING.md | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1cc437b88d..385f827217 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,49 +27,36 @@ Random order of test execution is provided by pytest-randomly, so more details a ## Integration tests -Every integration test should have `integration` mark. By default, integration tests are not execute when running `pytest`. +Integration tests are running against real Snowflake instance. Before running them you need to configure the connection to Snowflake. -To execute only integration tests run `pytest -m integration`. +To run integration tests run `pytest -m integration`. -### Connection parameters in `config.toml` +Integration tests live in `tests_integration` directory. Every integration test should have `integration` mark. +By default, integration tests are not execute when running `pytest` command. -Add the following connection to your `config.toml` +### Configuring integration tests connection +For running integration tests you will need to prepare your account. To do so you can execute the sql script +located in `test_integration/scripts/integration_account_setup.sql`. It will create required users, roles, +warehouses and other components. Before running it we highly recommend reviewing the script. +Integration tests are by default using `integration` connection. You can define one in your `config.toml` as follows: ```toml [connections.integration] -host = account = user = password = ``` -### Connection parameters in environment parameters +If you don't want to alter your config file you take advantage of snowcli environment variables for +overriding the connection parameters. Before running integration tests export the following variables: -Parameters must use the following format: - -``SNOWFLAKE_CONNECTIONS_INTEGRATION_=`` - -where ```` is the name of the key - -For example: SNOWFLAKE_CONNECTIONS_INTEGRATION_ACCOUNT="my-account" - -List of required parameter keys: -- host -- account -- user -- password - -### User requirements - -The user requires a default role with the following grants - -```snowflake -grant create database on account to role ; -grant create role on account to role ; -grant usage on warehouse xsmall to role ; -grant operate on warehouse xsmall to role ; +```bash +export SNOWFLAKE_CONNECTIONS_INTEGRATION_ACCOUNT="" +export SNOWFLAKE_CONNECTIONS_INTEGRATION_USER="" +export SNOWFLAKE_CONNECTIONS_INTEGRATION_PASSWORD="" ``` + ## Remote debugging with PyCharm or IntelliJ Snowflake CLI can connect to a remote debug server started in PyCharm or Intellij.