Skip to content

Commit

Permalink
Include external access integration in secret test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lindblomsebastian committed Apr 7, 2024
1 parent f4405c0 commit d1517b4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/functional/adapter/test_python_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,13 @@ def test_external_access_integration(self, project):
def model(dbt, session: snowpark.Session):
dbt.config(
materialized="table",
secrets={"secret_value": "test_secret"},
secrets={"secret_variable_name": "test_secret"},
external_access_integrations=["test_external_access_integration"],
)
import _snowflake
return session.create_dataframe(
pandas.DataFrame(
[{"secret_value": _snowflake.get_generic_secret_string(test_secret)}]
[{"secret_value": _snowflake.get_generic_secret_string(secret_variable_name)}]
)
)
"""
Expand All @@ -202,4 +203,15 @@ def test_secrets(self, project):
project.run_sql(
"create or replace secret test_secret type = generic_string secret_string='secret value';"
)

# The secrets you specify as values must also be specified in the external access integration.
# See https://docs.snowflake.com/en/developer-guide/external-network-access/creating-using-external-network-access#using-the-external-access-integration-in-a-function-or-procedure

# The SA running the integration tests does not have the required permissions.
# project.run_sql(
# "create or replace network rule test_network_rule type = host_port mode = egress value_list= ('www.google.com:443');"
# )
# project.run_sql(
# "create or replace external access integration test_external_access_integration allowed_network_rules = (test_network_rule) allowed_authentication_secrets = (test_secret) enabled = true;"
# )
run_dbt(["run"])

0 comments on commit d1517b4

Please sign in to comment.