From ca80c89693969029f712b69d1b47ead752c02547 Mon Sep 17 00:00:00 2001 From: Michael Yocca <19916665+mjyocca@users.noreply.github.com> Date: Wed, 24 Aug 2022 09:41:37 -0700 Subject: [PATCH] Remove beta comments and skipBeta from List Runs Options (#472) * cleanup runs list query parameter options * update changelog entry * update runs list options * runs list options cleanup * fix changelog typo * remove test case with temp inability to test * update changelog to include field rename on RunsListOptions --- CHANGELOG.md | 5 +++++ run.go | 24 +++++++++++++----------- run_integration_test.go | 21 +++------------------ 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79e55a14d..0709f190d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Unreleased Changes + +## Enhancements +* 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 ## Enhancements diff --git a/run.go b/run.go index 19052ee6a..b264546cb 100644 --- a/run.go +++ b/run.go @@ -205,24 +205,26 @@ const ( 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: Searches runs that matches the supplied VCS username. + User string `url:"search[user],omitempty"` - // Optional: Commit SHA for runs triggered via a vcs event - // **Note: This API is still in BETA and is subject to change.** + // Optional: Searches runs that matches the supplied commit sha. Commit string `url:"search[commit],omitempty"` - // Optional: Current status of the run - // **Note: This API is still in BETA and is subject to change.** + // 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 be omitted. + 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 - // **Note: This API is still in BETA and is subject to change.** + // 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 - // **Note: This API is still in BETA and is subject to change.** + // 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 ee10becef..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,20 +138,8 @@ func TestRunsListQueryParams(t *testing.T) { }, }, { - description: "with name parameter", - options: &RunListOptions{Name: 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", - options: &RunListOptions{Name: randomString(t), Commit: randomString(t), Include: []RunIncludeOpt{RunWorkspace}}, + 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) assert.Equal(t, 0, len(rl.Items)) @@ -163,7 +149,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) })