Skip to content

Commit

Permalink
Update Terraform to use DBSQL warehouse for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyAustinDavis committed Sep 26, 2023
1 parent 9865a10 commit 963cd03
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
TF_VAR_DBX_HOST: ${{ secrets.TH_DATABRICKS_WORKSPACE_HOST }}
TF_VAR_DBX_TOKEN: ${{ secrets.TH_DATABRICKS_WORKSPACE_TOKEN }}
TF_VAR_TEST_CATALOG: main
TF_VAR_TEST_SCHEMA: lb_test_harness
TF_VAR_TEST_SCHEMA: liquibase_harness_test_ds
WORKSPACE_ID: ${{ secrets.TH_DATABRICKS_WORKSPACE_ID }}

strategy:
Expand All @@ -42,9 +42,9 @@ jobs:
- name: Collect Databricks Config
working-directory: src/test/terraform
run: |
CLUSTER_ID=$(terraform output -raw cluster_url)
CLUSTER_ID=$(terraform output -raw endpoint_url)
DATABRICKS_HOST=${TF_VAR_DBX_HOST#https://}
echo "DATABRICKS_URL=jdbc:databricks://$DATABRICKS_HOST:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/$WORKSPACE_ID/$CLUSTER_ID;AuthMech=3;ConnCatalog=$TF_VAR_TEST_CATALOG;ConnSchema=$TF_VAR_TEST_SCHEMA;EnableArrow=0" >> "$GITHUB_ENV"
echo "DATABRICKS_URL=jdbc:databricks://$DATABRICKS_HOST:443/default;transportMode=http;ssl=1;httpPath=/sql/1.0/warehouses/$CLUSTER_ID;AuthMech=3;ConnCatalog=$TF_VAR_TEST_CATALOG;ConnSchema=$TF_VAR_TEST_SCHEMA;EnableArrow=0" >> "$GITHUB_ENV"
- name: Setup Temurin Java 17
uses: actions/setup-java@v3
Expand Down
1 change: 1 addition & 0 deletions src/test/terraform/auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ variable "DBX_HOST" {
variable "DBX_TOKEN" {
type = string
}

# Initialize the Databricks Terraform provider.
terraform {
required_providers {
Expand Down
2 changes: 1 addition & 1 deletion src/test/terraform/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variable "custom_spark_version" {
# of resources allowed.
data "databricks_node_type" "smallest" {
local_disk = true
min_cores = 8
min_cores = 4
photon_worker_capable = true
photon_driver_capable = true
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/terraform/dbsql_endpoint.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
data "databricks_current_user" "me" {}

resource "databricks_sql_endpoint" "this" {
name = "Databricks Liquibase Test Harness Endpoint"
cluster_size = "Small"
max_num_clusters = 1
warehouse_type = "PRO"
}

output "endpoint_url" {
value = databricks_sql_endpoint.this.id
}
8 changes: 0 additions & 8 deletions src/test/terraform/schema.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ variable "schema_force_destroy" {
default = true
}

resource "databricks_catalog" "main_cat" {
name = "main"
comment = "This database is for liquibase test harness"
properties = {
purpose = "testing"
}
}

resource "databricks_schema" "test_harness" {
catalog_name = var.TF_VAR_TEST_CATALOG
name = var.TF_VAR_TEST_SCHEMA
Expand Down

0 comments on commit 963cd03

Please sign in to comment.