Skip to content

Commit 37b7e43

Browse files
committed
2 parents 311cde6 + 4c2b87d commit 37b7e43

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

mmv1/products/dialogflowcx/TestCase.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ custom_code:
3535
pre_read: 'templates/terraform/pre_create/dialogflow_set_location.go.tmpl'
3636
pre_update: 'templates/terraform/pre_create/dialogflow_set_location.go.tmpl'
3737
pre_delete: 'templates/terraform/pre_create/dialogflow_set_location.go.tmpl'
38+
constants: 'templates/terraform/constants/dialogflowcx_test_case_session_parameters_diff_suppress.go.tmpl'
3839
exclude_sweeper: true
3940
examples:
4041
- name: 'dialogflowcx_test_case_full'
4142
primary_resource_id: 'basic_test_case'
4243
vars:
4344
agent_name: 'dialogflowcx-agent'
44-
# Skip in VCR until the test issue is resolved
45-
# https://github.com/hashicorp/terraform-provider-google/issues/21532
46-
skip_vcr: true
4745
parameters:
4846
- name: 'parent'
4947
type: String
@@ -194,6 +192,7 @@ properties:
194192
description: |
195193
The session parameters available to the bot at this point.
196194
state_func: 'func(v interface{}) string { s, _ := structure.NormalizeJsonString(v); return s }'
195+
diff_suppress_func: 'dialogflowcxTestCaseSessionParametersDiffSuppress'
197196
custom_flatten: 'templates/terraform/custom_flatten/json_schema.tmpl'
198197
custom_expand: 'templates/terraform/custom_expand/json_schema.tmpl'
199198
validation:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
func dialogflowcxTestCaseSessionParametersDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
2+
// Treat empty string and empty JSON object as equivalent
3+
if (old == "" || old == "{}") && (new == "" || new == "{}") {
4+
return true
5+
}
6+
7+
if old == "" || new == "" {
8+
return old == new
9+
}
10+
11+
var oldJson, newJson interface{}
12+
13+
if err := json.Unmarshal([]byte(old), &oldJson); err != nil {
14+
return false
15+
}
16+
17+
if err := json.Unmarshal([]byte(new), &newJson); err != nil {
18+
return false
19+
}
20+
21+
return reflect.DeepEqual(oldJson, newJson)
22+
}

mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflow_cx_test_case_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ import (
1212
func TestAccDialogflowCXTestCase_update(t *testing.T) {
1313
t.Parallel()
1414

15-
// Skip in VCR until the test issue is resolved
16-
// https://github.com/hashicorp/terraform-provider-google/issues/25227
17-
acctest.SkipIfVcr(t)
18-
1915
context := map[string]interface{}{
2016
"org_id": envvar.GetTestOrgFromEnv(t),
2117
"billing_account": envvar.GetTestBillingAccountFromEnv(t),

mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflow_cx_tool_test.go renamed to mmv1/third_party/terraform/services/dialogflowcx/resource_dialogflow_cx_tool_test.go.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ func testAccDialogflowCXTool_full_bearer_token(context map[string]interface{}) s
309309
`, context)
310310
}
311311

312+
{{ if ne $.TargetVersionName `ga` -}}
312313
func TestAccDialogflowCXTool_dialogflowcxToolConnectorExample_update(t *testing.T) {
313314
t.Parallel()
314315

@@ -550,3 +551,4 @@ data "google_project" "test_project" {
550551
}
551552
`, context)
552553
}
554+
{{- end }}

0 commit comments

Comments
 (0)