From 70885e0a7b5acfa0f8bd5c850c4e41678a2e560e Mon Sep 17 00:00:00 2001 From: Michael Yocca Date: Tue, 12 Jul 2022 09:08:53 -0700 Subject: [PATCH 1/7] cleanup runs list query parameter options --- run.go | 5 ----- run_integration_test.go | 1 - 2 files changed, 6 deletions(-) diff --git a/run.go b/run.go index 19052ee6a..1d7dd0672 100644 --- a/run.go +++ b/run.go @@ -206,23 +206,18 @@ type RunListOptions struct { ListOptions // Optional: Username of user who created the run - // **Note: This API is still in BETA and is subject to change.** Name string `url:"search[name],omitempty"` // Optional: Commit SHA for runs triggered via a vcs event - // **Note: This API is still in BETA and is subject to change.** Commit string `url:"search[commit],omitempty"` // Optional: Current status of the run - // **Note: This API is still in BETA and is subject to change.** Status string `url:"filter[status],omitempty"` // Optional: Source that triggered the run - // **Note: This API is still in BETA and is subject to change.** Source string `url:"filter[source],omitempty"` // Optional: Operation type for the run - // **Note: This API is still in BETA and is subject to change.** Operation string `url:"filter[operation],omitempty"` // Optional: A list of relations to include. See available resources: diff --git a/run_integration_test.go b/run_integration_test.go index ee10becef..304c37d40 100644 --- a/run_integration_test.go +++ b/run_integration_test.go @@ -163,7 +163,6 @@ func TestRunsListQueryParams(t *testing.T) { for _, testCase := range testCases { t.Run(testCase.description, func(t *testing.T) { - skipIfBeta(t) runs, err := client.Runs.List(ctx, workspaceTest.ID, testCase.options) testCase.assertion(testCase, runs, err) }) From 91d4284eef13014f788fba758d851943959585af Mon Sep 17 00:00:00 2001 From: Michael Yocca Date: Wed, 27 Jul 2022 08:34:43 -0700 Subject: [PATCH 2/7] update changelog entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79e55a14d..bf45cb536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Unreleased Changes + +## Enhancements +* Remove beta messaging for `RunListOptions` by @mjyocca [#472](https://github.com/hashicorp/go-tfe/pull/472) + # v1.8.0 ## Enhancements From 5e7d20ba789d20823fe26aeb887728c58436ce09 Mon Sep 17 00:00:00 2001 From: Michael Yocca Date: Tue, 23 Aug 2022 09:35:42 -0700 Subject: [PATCH 3/7] update runs list options --- run.go | 19 +++++++++++++------ run_integration_test.go | 4 ++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/run.go b/run.go index 1d7dd0672..ee08c1620 100644 --- a/run.go +++ b/run.go @@ -205,19 +205,26 @@ const ( type RunListOptions struct { ListOptions - // Optional: Username of user who created the run - Name string `url:"search[name],omitempty"` + // Optional: Searches runs that matches the supplied VCS username. + User string `url:"search[user],omitempty"` - // Optional: Commit SHA for runs triggered via a vcs event + // Optional: Searches runs that matches the supplied commit sha. Commit string `url:"search[commit],omitempty"` - // Optional: Current status of the run + // Optional: Searches runs that matches the supplied VCS username, commit sha, run_id, and run message. + // The presence of search[commit] or search[user] takes priority over this parameter and will cause it to not be used. + Search string `url:"search[basic],omitempty"` + + // Optional: Current status of the run. + // Options are listed at https://www.terraform.io/cloud-docs/api-docs/run#run-states Status string `url:"filter[status],omitempty"` - // Optional: Source that triggered the run + // Optional: Source that triggered the run. + // Options are listed at https://www.terraform.io/cloud-docs/api-docs/run#run-sources Source string `url:"filter[source],omitempty"` - // Optional: Operation type for the run + // Optional: Operation type for the run. + // Options are listed at https://www.terraform.io/cloud-docs/api-docs/run#run-operations Operation string `url:"filter[operation],omitempty"` // Optional: A list of relations to include. See available resources: diff --git a/run_integration_test.go b/run_integration_test.go index 304c37d40..73f622b1c 100644 --- a/run_integration_test.go +++ b/run_integration_test.go @@ -141,7 +141,7 @@ func TestRunsListQueryParams(t *testing.T) { }, { description: "with name parameter", - options: &RunListOptions{Name: currentUser.Username, Include: []RunIncludeOpt{RunWorkspace}}, + options: &RunListOptions{User: currentUser.Username, Include: []RunIncludeOpt{RunWorkspace}}, assertion: func(tc testCase, rl *RunList, err error) { found := []string{} for _, r := range rl.Items { @@ -153,7 +153,7 @@ func TestRunsListQueryParams(t *testing.T) { }, { description: "with name & commit parameter", - options: &RunListOptions{Name: randomString(t), Commit: randomString(t), Include: []RunIncludeOpt{RunWorkspace}}, + options: &RunListOptions{User: randomString(t), Commit: randomString(t), Include: []RunIncludeOpt{RunWorkspace}}, assertion: func(tc testCase, rl *RunList, err error) { require.NoError(t, err) assert.Equal(t, 0, len(rl.Items)) From 0a294b3bef4c6df8ee9dc139f5d8100edd6bf34b Mon Sep 17 00:00:00 2001 From: Michael Yocca Date: Tue, 23 Aug 2022 09:41:45 -0700 Subject: [PATCH 4/7] runs list options cleanup --- CHANGELOG.md | 2 +- run.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf45cb536..88e43c0d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased Changes ## Enhancements -* Remove beta messaging for `RunListOptions` by @mjyocca [#472](https://github.com/hashicorp/go-tfe/pull/472) +* Remove beta messaging for and updates for `RunListOptions` struct by @mjyocca [#472](https://github.com/hashicorp/go-tfe/pull/472) # v1.8.0 diff --git a/run.go b/run.go index ee08c1620..b264546cb 100644 --- a/run.go +++ b/run.go @@ -212,7 +212,7 @@ type RunListOptions struct { Commit string `url:"search[commit],omitempty"` // Optional: Searches runs that matches the supplied VCS username, commit sha, run_id, and run message. - // The presence of search[commit] or search[user] takes priority over this parameter and will cause it to not be used. + // The presence of search[commit] or search[user] takes priority over this parameter and will be omitted. Search string `url:"search[basic],omitempty"` // Optional: Current status of the run. From 25799c658a3f4aa7986a73cb09ca7ba3b494969f Mon Sep 17 00:00:00 2001 From: Michael Yocca Date: Tue, 23 Aug 2022 09:42:43 -0700 Subject: [PATCH 5/7] fix changelog typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88e43c0d4..79f773603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased Changes ## Enhancements -* Remove beta messaging for and updates for `RunListOptions` struct by @mjyocca [#472](https://github.com/hashicorp/go-tfe/pull/472) +* Remove beta messaging and cleanup for `RunListOptions` struct by @mjyocca [#472](https://github.com/hashicorp/go-tfe/pull/472) # v1.8.0 From e3c9d0ba6ef54f524b91f10d63d897a31e1c7794 Mon Sep 17 00:00:00 2001 From: Michael Yocca Date: Tue, 23 Aug 2022 21:52:26 -0700 Subject: [PATCH 6/7] remove test case with temp inability to test --- run_integration_test.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/run_integration_test.go b/run_integration_test.go index 73f622b1c..e70f7526f 100644 --- a/run_integration_test.go +++ b/run_integration_test.go @@ -109,9 +109,7 @@ func TestRunsListQueryParams(t *testing.T) { workspaceTest, _ := createWorkspace(t, client, orgTest) createPlannedRun(t, client, workspaceTest) - pendingRun, _ := createRun(t, client, workspaceTest) - - currentUser, _ := client.Users.ReadCurrent(ctx) + createRun(t, client, workspaceTest) testCases := []testCase{ { @@ -140,19 +138,7 @@ func TestRunsListQueryParams(t *testing.T) { }, }, { - description: "with name parameter", - options: &RunListOptions{User: currentUser.Username, Include: []RunIncludeOpt{RunWorkspace}}, - assertion: func(tc testCase, rl *RunList, err error) { - found := []string{} - for _, r := range rl.Items { - found = append(found, r.ID) - } - assert.Equal(t, 2, len(rl.Items)) - assert.Contains(t, found, pendingRun.ID) - }, - }, - { - description: "with name & commit parameter", + description: "with mismatch user & commit parameter", options: &RunListOptions{User: randomString(t), Commit: randomString(t), Include: []RunIncludeOpt{RunWorkspace}}, assertion: func(tc testCase, rl *RunList, err error) { require.NoError(t, err) From af2f3359166065306eb8c9e6851c39c7e3e3468d Mon Sep 17 00:00:00 2001 From: Michael Yocca Date: Wed, 24 Aug 2022 08:55:54 -0700 Subject: [PATCH 7/7] update changelog to include field rename on RunsListOptions --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f773603..0709f190d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased Changes ## Enhancements -* Remove beta messaging and cleanup for `RunListOptions` struct by @mjyocca [#472](https://github.com/hashicorp/go-tfe/pull/472) +* Beta removal for `RunListOptions`, in addition to a Field rename (Name -> User) by @mjyocca [#472](https://github.com/hashicorp/go-tfe/pull/472) # v1.8.0