Skip to content

Commit b60cb93

Browse files
committed
wip
1 parent 6d8d1c5 commit b60cb93

File tree

7 files changed

+235
-164
lines changed

7 files changed

+235
-164
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ docker_test_integration:
6464
-e SERVICE_ACCOUNT_JSON \
6565
-v $(CURDIR):/workspace \
6666
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
67-
/usr/local/bin/test_integration.sh
67+
cft test run all
6868

6969
# Execute lint tests within the docker container
7070
.PHONY: docker_test_lint

build/int.cloudbuild.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@ steps:
2424
- 'TF_VAR_org_id=$_ORG_ID'
2525
- 'TF_VAR_folder_id=$_FOLDER_ID'
2626
- 'TF_VAR_billing_account=$_BILLING_ACCOUNT'
27-
- id: create
27+
- id: multiple-tables
2828
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
29-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create']
30-
- id: converge
31-
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
32-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge']
33-
- id: verify
34-
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
35-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify']
36-
- id: destroy
37-
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
38-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy']
29+
args: ['/bin/bash', '-c', 'cft test run TestMultipleTables --verbose']
3930
- id: create-dwh
31+
waitFor: prepare
4032
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
4133
args: ['/bin/bash', '-c', 'cft test run TestDataWarehouse --stage init --verbose']
4234
- id: apply-dwh

test/integration/data_warehouse/data_warehouse_test.go

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,28 +66,28 @@ func TestDataWarehouse(t *testing.T) {
6666
utils.Poll(t, verifyWorkflows, 8, 30*time.Second)
6767

6868
homeDir, err := os.UserHomeDir()
69-
if err != nil {
70-
log.Fatal(err)
71-
}
72-
file, err := os.Create(homeDir + "/.bigqueryrc")
73-
if err != nil {
74-
log.Fatal(err)
75-
}
76-
file.Close()
69+
if err != nil {
70+
log.Fatal(err)
71+
}
72+
file, err := os.Create(homeDir + "/.bigqueryrc")
73+
if err != nil {
74+
log.Fatal(err)
75+
}
76+
file.Close()
7777

7878
// Assert BigQuery tables & views are not empty
79-
test_tables := func (){
79+
test_tables := func() {
8080

8181
tables := []string{
82-
"thelook.distribution_centers",
83-
"thelook.events",
84-
"thelook.inventory_items",
85-
"thelook.order_items",
86-
"thelook.orders",
87-
"thelook.products",
88-
"thelook.users",
89-
"thelook.lookerstudio_report_distribution_centers",
90-
"thelook.lookerstudio_report_profit",
82+
"thelook.distribution_centers",
83+
"thelook.events",
84+
"thelook.inventory_items",
85+
"thelook.order_items",
86+
"thelook.orders",
87+
"thelook.products",
88+
"thelook.users",
89+
"thelook.lookerstudio_report_distribution_centers",
90+
"thelook.lookerstudio_report_profit",
9191
}
9292

9393
query_template := "SELECT COUNT(*) AS count_rows FROM `%[1]s.%[2]s`;"
@@ -108,7 +108,6 @@ func TestDataWarehouse(t *testing.T) {
108108

109109
// Assert BigQuery connection to Vertex GenAI was successfully created and works as expected
110110
test_llms := func() {
111-
112111
llm_query_template := "SELECT COUNT(*) AS count_rows FROM ML.GENERATE_TEXT(MODEL `%[1]s.thelook.text_generate_model`, (with clusters AS(SELECT CONCAT('cluster', CAST(centroid_id as STRING)) as centroid, avg_spend as average_spend, count_orders as count_of_orders, days_since_order FROM (SELECT centroid_id, feature, ROUND(numerical_value, 2) as value FROM ML.CENTROIDS(MODEL `%[1]s.thelook.customer_segment_clustering`)) PIVOT (SUM(value) FOR feature IN ('avg_spend', 'count_orders', 'days_since_order')) ORDER BY centroid_id) SELECT 'Pretend you are a creative strategist, given the following clusters come up with creative brand persona and title labels for each of these clusters, and explain step by step; what would be the next marketing step for these clusters' || ' ' || clusters.centroid || ', Average Spend $' || clusters.average_spend || ', Count of orders per person ' || clusters.count_of_orders || ', Days since last order ' || clusters.days_since_order AS prompt FROM clusters), STRUCT(800 AS max_output_tokens, 0.8 AS temperature, 40 AS top_k, 0.8 AS top_p, TRUE AS flatten_json_output));"
113112
query := fmt.Sprintf(llm_query_template, projectID)
114113
llm_op := bq.Runf(t, "--project_id=%[1]s --headless=true query --nouse_legacy_sql %[2]s", projectID, query)
@@ -117,9 +116,9 @@ func TestDataWarehouse(t *testing.T) {
117116
count_llm_kind := reflect.TypeOf(llm_count).Kind()
118117
llm_test_result := assert.Greater(llm_count, int64(0))
119118
if llm_test_result == true {
120-
} else {
121-
fmt.Printf("Some kind of error occurred while running the llm_count query. We think it has %[1]d rows. Here's some additional details: \n Query results. If this number is greater than 0, then there is probably an issue in the comparison: %[2]s \n Variable type for the count. This should be INT64: %[3]s \n ", llm_count, llm_op, count_llm_kind)
122-
}
119+
} else {
120+
fmt.Printf("Some kind of error occurred while running the llm_count query. We think it has %[1]d rows. Here's some additional details: \n Query results. If this number is greater than 0, then there is probably an issue in the comparison: %[2]s \n Variable type for the count. This should be INT64: %[3]s \n ", llm_count, llm_op, count_llm_kind)
121+
}
123122
}
124123
test_llms()
125124
})

test/integration/full/controls/big_query.rb

Lines changed: 0 additions & 93 deletions
This file was deleted.

test/integration/full/inspec.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)