Skip to content

Commit

Permalink
testing script to revert back to Zane's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-tmathew committed Nov 22, 2024
1 parent 9c012f6 commit c3b53fa
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 142 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dev-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ jobs:
run: |
echo "Current Directory: ${PWD}"
echo "GITHUB WORKSPACE: ${GITHUB_WORKSPACE}"
chmod +x testSchemachange.sh
bash testSchemachange.sh
chmod +x testSchemachange2.sh
bash testSchemachange2.sh
working-directory: .
15 changes: 0 additions & 15 deletions demo/basics_demo/3_teardown/schemachange-config.yml

This file was deleted.

15 changes: 0 additions & 15 deletions demo/citibike_demo/1_setup/schemachange-config.yml

This file was deleted.

15 changes: 0 additions & 15 deletions demo/citibike_demo/3_teardown/schemachange-config.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
config-version: 1

root-folder: "./demo/{{ env_var('SCENARIO_NAME')}}/2_test"
snowflake-user: "{{env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{env_var('SNOWFLAKE_WAREHOUSE')}}"

change-history-table: "{{ env_var('SNOWFLAKE_DATABASE')}}.{{ env_var('MY_TARGET_SCHEMA')}}.CHANGE_HISTORY"
create-change-history-table: true

Expand Down
15 changes: 0 additions & 15 deletions demo/citibike_demo_jinja/3_teardown/schemachange-config.yml

This file was deleted.

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

root-folder: "./demo/{{ env_var('SCENARIO_NAME')}}/2_test"
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')}}"

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
@@ -1,11 +1,5 @@
config-version: 1

root-folder: "./demo/{{ env_var('SCENARIO_NAME')}}/1_setup"
snowflake-user: "{{env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{env_var('SNOWFLAKE_WAREHOUSE')}}"

# 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
@@ -1,11 +1,5 @@
config-version: 1

root-folder: "./demo/{{ env_var('SCENARIO_NAME')}}/1_setup"
snowflake-user: "{{env_var('SNOWFLAKE_USER')}}"
snowflake-account: "{{env_var('SNOWFLAKE_ACCOUNT')}}"
snowflake-role: "{{env_var('SNOWFLAKE_ROLE')}}"
snowflake-warehouse: "{{env_var('SNOWFLAKE_WAREHOUSE')}}"

# 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
58 changes: 1 addition & 57 deletions testSchemachange.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,60 +29,4 @@ echo "::endgroup::"

if [ $RESULT -ne 0 ]; then
exit 1
fi

echo "::group::Setting up ${MY_TARGET_SCHEMA}"
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 \
--verbose
echo "::endgroup::"

echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}"

schemachange render \
--config-folder ./demo/${SCENARIO_NAME} \
./demo/${SCENARIO_NAME}/2_test/A__render.sql
schemachange render \
--config-folder ./demo/${SCENARIO_NAME} \
./demo/${SCENARIO_NAME}/2_test/R__render.sql
schemachange render \
--config-folder ./demo/${SCENARIO_NAME} \
./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} \
--connection-name default \
--connections-file-path ./connections.toml \
--root-folder ./demo/${SCENARIO_NAME}/2_test \
--verbose
RESULT=$?

if [ $RESULT -eq 0 ]; then
echo "Deployment Completed!"
else
echo "Deployment Failed. Proceeding to Teardown."
fi
echo "::endgroup::"

set -e

echo "::group::Tearing down up ${MY_TARGET_SCHEMA}"
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 \
--verbose
echo "::endgroup::"

if [ $RESULT -ne 0 ]; then
exit 1
fi
fi

0 comments on commit c3b53fa

Please sign in to comment.