Skip to content

Commit

Permalink
feat: restructure integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zane Clark committed Nov 15, 2024
1 parent f35f1a6 commit fb2f2a4
Show file tree
Hide file tree
Showing 35 changed files with 50 additions and 99 deletions.
57 changes: 50 additions & 7 deletions .github/workflows/master-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Create and populate connections.toml
run: |
touch connections.toml
echo [default] >> connections.toml
echo account = "$SNOWFLAKE_ACCOUNT" >> connections.toml
echo user = "$SNOWFLAKE_USER" >> connections.toml
echo role = "$SNOWFLAKE_ROLE" >> connections.toml
echo warehouse = "$SNOWFLAKE_WAREHOUSE" >> connections.toml
echo database = "$SNOWFLAKE_DATABASE" >> connections.toml
echo schema = "$MY_TARGET_SCHEMA" >> connections.toml
echo password = "$SCHEMACHANGE_SNOWFLAKE_PASSWORD" >> connections.toml
echo "cat connections.toml"
cat connections.toml
- name: Test with pytest
id: pytest
run: |
Expand All @@ -66,16 +79,39 @@ jobs:
- name: Test Schemachange on ${{ matrix.os }} targeting ${{ env.SNOWFLAKE_DATABASE }}.${{ env.MY_TARGET_SCHEMA }} schema
run: |
echo "::group::Setting up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/setup/${SCENARIO_NAME}
echo "::endgroup::"
schemachange deploy \
--config-folder ./demo \
--config-file-name schemachange-config-setup.yml \
--root-folder ./demo/${SCENARIO_NAME}/1_setup \
--connection-name default \
--connections-file-path connections.toml
echo "::endgroup::"'
echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}"
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/A__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/R__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/V1.0.0__render.sql
schemachange render \
--config-folder ./demo/${SCENARIO_NAME} \
--connection-name default \
--connections-file-path connections.toml \
./demo/${SCENARIO_NAME}/2_test/A__render.sql
schemachange render \
--config-folder ./demo/${SCENARIO_NAME} \
--connection-name default \
--connections-file-path connections.toml \
./demo/${SCENARIO_NAME}/2_test/R__render.sql
schemachange render \
--config-folder ./demo/${SCENARIO_NAME} \
--connection-name default \
--connections-file-path connections.toml
./demo/${SCENARIO_NAME}/2_test/V1.0.0__render.sql
echo "::endgroup::"
echo "::group::Testing Deployment using ${MY_TARGET_SCHEMA}"
set +e
schemachange deploy --config-folder ./demo/${SCENARIO_NAME}
schemachange deploy \
--config-folder ./demo/${SCENARIO_NAME} \
--connection-name default \
--connections-file-path connections.toml \
--root-folder ./demo/${SCENARIO_NAME}/2_test
RESULT=$?
if [ $RESULT -eq 0 ]; then
echo "Deployment Completed!"
Expand All @@ -84,9 +120,16 @@ jobs:
fi
echo "::endgroup::"
set -e
echo "::group::Tearing down up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/teardown/${SCENARIO_NAME}
schemachange deploy \
--config-folder ./demo \
--config-file-name schemachange-config-teardown.yml \
--connection-name default \
--connections-file-path connections.toml \
--root-folder ./demo/${SCENARIO_NAME}/3_teardown \
echo "::endgroup::"
if [ $RESULT -ne 0 ]; then
exit 1
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions demo/basics_demo/schemachange-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ config-version: 1

root-folder: "./demo/{{ env_var('SCENARIO_NAME')}}"

snowflake-user: "{{ env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{ env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{ env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{ env_var('SNOWFLAKE_WAREHOUSE')}}"
snowflake-database: "{{ env_var('SNOWFLAKE_DATABASE')}}"
snowflake-schema: "{{ env_var('MY_TARGET_SCHEMA')}}"
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.{{ env_var('MY_TARGET_SCHEMA')}}.CHANGE_HISTORY"
create-change-history-table: true

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions demo/citibike_demo/schemachange-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ config-version: 1

root-folder: "./demo/{{ env_var('SCENARIO_NAME')}}"

snowflake-user: "{{ env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{ env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{ env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{ env_var('SNOWFLAKE_WAREHOUSE')}}"
snowflake-database: "{{ env_var('SNOWFLAKE_DATABASE')}}"
snowflake-schema: "{{ env_var('MY_TARGET_SCHEMA')}}"
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.{{ env_var('MY_TARGET_SCHEMA')}}.CHANGE_HISTORY"
create-change-history-table: true

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions demo/citibike_demo_jinja/schemachange-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ config-version: 1
root-folder: "./demo/{{ env_var('SCENARIO_NAME')}}"
modules-folder: "./demo/{{ env_var('SCENARIO_NAME')}}/modules"

snowflake-user: "{{ env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{ env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{ env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{ env_var('SNOWFLAKE_WAREHOUSE')}}"
snowflake-database: "{{ env_var('SNOWFLAKE_DATABASE')}}"
snowflake-schema: "{{ env_var('MY_TARGET_SCHEMA')}}"
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.{{ env_var('MY_TARGET_SCHEMA')}}.CHANGE_HISTORY"
create-change-history-table: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ config-version: 1

root-folder: "./demo/setup/{{ env_var('SCENARIO_NAME')}}"

snowflake-user: "{{ env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{ env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{ env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{ env_var('SNOWFLAKE_WAREHOUSE')}}"
snowflake-database: "{{ env_var('SNOWFLAKE_DATABASE')}}"
# tracking the setup step in a different change history table to use schemachange setup and teardown separate from deployment.
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.{{ env_var('SCENARIO_NAME')}}_CHANGE_HISTORY"
create-change-history-table: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ config-version: 1

root-folder: "./demo/teardown/{{ env_var('SCENARIO_NAME')}}"

snowflake-user: "{{ env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{ env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{ env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{ env_var('SNOWFLAKE_WAREHOUSE')}}"
snowflake-database: "{{ env_var('SNOWFLAKE_DATABASE')}}"
# tracking the setup step in a different change history table to use schemachange setup and teardown separate from deployment.
change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.SCHEMACHANGE.{{ env_var('SCENARIO_NAME')}}_CHANGE_HISTORY"
create-change-history-table: true
Expand Down
16 changes: 0 additions & 16 deletions demo/setup/citibike_demo/schemachange-config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions demo/setup/citibike_demo_jinja/schemachange-config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions demo/teardown/basics_demo/schemachange-config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions demo/teardown/citibike_demo_jinja/schemachange-config.yml

This file was deleted.

0 comments on commit fb2f2a4

Please sign in to comment.