Skip to content

Commit

Permalink
Enable Patching Workflows (#4733)
Browse files Browse the repository at this point in the history
Co-authored-by: upodroid <cy@borg.dev>
  • Loading branch information
upodroid authored Apr 28, 2021
1 parent 5664a39 commit f5e6c25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
2 changes: 0 additions & 2 deletions mmv1/products/workflows/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@ objects:
A set of key/value label pairs to assign to this Workflow.
- !ruby/object:Api::Type::String
name: 'serviceAccount'
input: true
description: |
Name of the service account associated with the latest workflow version. This service
account represents the identity of the workflow and determines what permissions the workflow has.
Format: projects/{project}/serviceAccounts/{account}.
- !ruby/object:Api::Type::String
name: 'sourceContents'
input: true
description: |
Workflow code to be executed. The size limit is 32KB.
- !ruby/object:Api::Type::String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccWorkflowsWorkflow_basic(t *testing.T) {
func TestAccWorkflowsWorkflow_Update(t *testing.T) {
// Custom test written to test diffs
t.Parallel()

bucketName := fmt.Sprintf("tf-test-acc-bucket-%d", randInt(t))
workflowName := fmt.Sprintf("tf-test-acc-workflow-%d", randInt(t))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckWorkflowsWorkflowDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccWorkflowsWorkflow_basic(bucketName),
Config: testAccWorkflowsWorkflow_Update(workflowName),
},
{
Config: testAccWorkflowsWorkflow_newBucket(bucketName),
Config: testAccWorkflowsWorkflow_Updated(workflowName),
},
},
})
}

func testAccWorkflowsWorkflow_basic(name string) string {
func testAccWorkflowsWorkflow_Update(name string) string {
return fmt.Sprintf(`
resource "google_workflows_workflow" "example" {
name = "%s"
Expand Down Expand Up @@ -66,12 +66,8 @@ EOF
`, name)
}

func testAccWorkflowsWorkflow_newBucket(name string) string {
func testAccWorkflowsWorkflow_Updated(name string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
name = "%s"
}
resource "google_workflows_workflow" "example" {
name = "%s"
region = "us-central1"
Expand All @@ -95,7 +91,7 @@ resource "google_workflows_workflow" "example" {
- readWikipedia:
call: http.get
args:
url: https://en.wikipedia.org/w/api.php
url: https:/fi.wikipedia.org/w/api.php
query:
action: opensearch
search: $${CurrentDateTime.body.dayOfTheWeek}
Expand All @@ -104,7 +100,7 @@ resource "google_workflows_workflow" "example" {
return: $${WikiResult.body[1]}
EOF
}
`, name, name)
`, name)
}

func TestWorkflowsWorkflowStateUpgradeV0(t *testing.T) {
Expand Down

0 comments on commit f5e6c25

Please sign in to comment.