-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update eventarc trigger yaml, markdown to allow setting transport * Update test, add handwritten utils * Update handwritten * Updating eventarc test * Updating trigger * Adding dataproc workflow * Updating expanders * Updates to prop, resource to handle refs * Add support for workflow in GA * fix merge issues * Add template markdown
- Loading branch information
Showing
11 changed files
with
4,498 additions
and
39 deletions.
There are no files selected for viewing
127 changes: 127 additions & 0 deletions
127
mmv1/third_party/terraform/tests/resource_dataproc_workflow_template_test.go.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<% autogen_exception -%> | ||
package google | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccDataprocWorkflowTemplate_basic(t *testing.T) { | ||
// DCL currently fails due to transport modification | ||
skipIfVcr(t) | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"random_suffix": randString(t, 10), | ||
"project": getTestProjectFromEnv(), | ||
} | ||
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: funcAccTestDataprocWorkflowTemplateCheckDestroy(t), | ||
ExternalProviders: map[string]resource.ExternalProvider{ | ||
"random": {}, | ||
}, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDataprocWorkflowTemplate_basic(context), | ||
}, | ||
{ | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ResourceName: "google_dataproc_workflow_template.template", | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataprocWorkflowTemplate_basic(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_dataproc_workflow_template" "template" { | ||
name = "template%{random_suffix}" | ||
location = "us-central1" | ||
placement { | ||
managed_cluster { | ||
cluster_name = "my-cluster" | ||
config { | ||
gce_cluster_config { | ||
zone = "us-central1-a" | ||
tags = ["foo", "bar"] | ||
} | ||
master_config { | ||
num_instances = 1 | ||
machine_type = "n1-standard-1" | ||
disk_config { | ||
boot_disk_type = "pd-ssd" | ||
boot_disk_size_gb = 15 | ||
} | ||
} | ||
worker_config { | ||
num_instances = 3 | ||
machine_type = "n1-standard-2" | ||
disk_config { | ||
boot_disk_size_gb = 10 | ||
num_local_ssds = 2 | ||
} | ||
} | ||
|
||
secondary_worker_config { | ||
num_instances = 2 | ||
} | ||
software_config { | ||
image_version = "1.3.7-deb9" | ||
} | ||
} | ||
} | ||
} | ||
jobs { | ||
step_id = "someJob" | ||
spark_job { | ||
main_class = "SomeClass" | ||
} | ||
} | ||
jobs { | ||
step_id = "otherJob" | ||
prerequisite_step_ids = ["someJob"] | ||
presto_job { | ||
query_file_uri = "someuri" | ||
} | ||
} | ||
} | ||
`, context) | ||
} | ||
|
||
func funcAccTestDataprocWorkflowTemplateCheckDestroy(t *testing.T) func(s *terraform.State) error { | ||
return func(s *terraform.State) error { | ||
for name, rs := range s.RootModule().Resources { | ||
if rs.Type != "google_dataproc_workflow_template" { | ||
continue | ||
} | ||
if strings.HasPrefix(name, "data.") { | ||
continue | ||
} | ||
|
||
config := googleProviderConfig(t) | ||
|
||
url, err := replaceVarsForTest(config, rs, "{{DataprocBasePath}}projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
billingProject := "" | ||
|
||
if config.BillingProject != "" { | ||
billingProject = config.BillingProject | ||
} | ||
|
||
_, err = sendRequest(config, "GET", billingProject, url, config.userAgent, nil) | ||
if err == nil { | ||
return fmt.Errorf("DataprocWorkflowTemplate still exists at %s", url) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.