Skip to content

Commit

Permalink
Remove beta comments and skipBeta from List Runs Options (#472)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mjyocca committed Aug 24, 2022
1 parent 6c169e0 commit ca80c89
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
5 changes: 5 additions & 0 deletions 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
Expand Down
24 changes: 13 additions & 11 deletions run.go
Expand Up @@ -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:
Expand Down
21 changes: 3 additions & 18 deletions run_integration_test.go
Expand Up @@ -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{
{
Expand Down Expand Up @@ -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))
Expand All @@ -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)
})
Expand Down

0 comments on commit ca80c89

Please sign in to comment.