Skip to content

Commit

Permalink
Update run tasks as not beta
Browse files Browse the repository at this point in the history
Previously Run Tasks was marked as beta in go-tfe. However Run Tasks is now
Generally Available. This commit updates go-tfe to mark Run Tasks as not
Beta.
  • Loading branch information
glennsarti committed Jul 7, 2022
1 parent 05a88ee commit ea2578f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
* Adds support for new `ExcludeTags` workspace list filter field by @Uk1288 [#438](https://github.com/hashicorp/go-tfe/pull/438)
* [beta] Adds additional filter fields to `RunListOptions` by @mjyocca [#424](https://github.com/hashicorp/go-tfe/pull/424)
* [beta] Renames the optional StateVersion field `ExtState` to `JSONStateOutputs` and changes the purpose and type by @annawinkler [#444](https://github.com/hashicorp/go-tfe/pull/444) and @brandoncroft [#452](https://github.com/hashicorp/go-tfe/pull/452)
* Remove beta messaging for Run Tasks by @glennsarti [#447](https://github.com/hashicorp/go-tfe/pull/447)

# v1.3.0

Expand Down
9 changes: 4 additions & 5 deletions run_task.go
Expand Up @@ -11,8 +11,7 @@ var _ RunTasks = (*runTasks)(nil)

// RunTasks represents all the run task related methods in the context of an organization
// that the Terraform Cloud/Enterprise API supports.
// **Note: This API is still in BETA and subject to change.**
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#run-tasks-api
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#run-tasks-api
type RunTasks interface {
// Create a run task for an organization
Create(ctx context.Context, organization string, options RunTaskCreateOptions) (*RunTask, error)
Expand Down Expand Up @@ -61,7 +60,7 @@ type RunTaskList struct {
}

// RunTaskIncludeOpt represents the available options for include query params.
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#list-run-tasks
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#list-run-tasks
type RunTaskIncludeOpt string

const (
Expand All @@ -73,14 +72,14 @@ const (
type RunTaskListOptions struct {
ListOptions
// Optional: A list of relations to include with a run task. See available resources:
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#list-run-tasks
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#list-run-tasks
Include []RunTaskIncludeOpt `url:"include,omitempty"`
}

// RunTaskReadOptions represents the set of options for reading a run task
type RunTaskReadOptions struct {
// Optional: A list of relations to include with a run task. See available resources:
// https://www.terraform.io/cloud-docs/api-docs/run-tasks#list-run-tasks
// https://www.terraform.io/cloud-docs/api-docs/run-tasks/run-tasks#list-run-tasks
Include []RunTaskIncludeOpt `url:"include,omitempty"`
}

Expand Down
17 changes: 11 additions & 6 deletions run_task_integration_test.go
Expand Up @@ -13,7 +13,7 @@ import (
)

func TestRunTasksCreate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestRunTasksCreate(t *testing.T) {
}

func TestRunTasksList(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -75,7 +75,7 @@ func TestRunTasksList(t *testing.T) {
}

func TestRunTasksRead(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestRunTasksRead(t *testing.T) {
}

func TestRunTasksUpdate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -151,7 +151,7 @@ func TestRunTasksUpdate(t *testing.T) {
}

func TestRunTasksDelete(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestRunTasksDelete(t *testing.T) {
}

func TestRunTasksAttachToWorkspace(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -197,6 +197,11 @@ func TestRunTasksAttachToWorkspace(t *testing.T) {

t.Run("to a valid workspace", func(t *testing.T) {
wr, err := client.RunTasks.AttachToWorkspace(ctx, wkspaceTest.ID, runTaskTest.ID, Advisory)

defer func() {
client.WorkspaceRunTasks.Delete(ctx, wkspaceTest.ID, wr.ID)
}()

require.NoError(t, err)
require.NotNil(t, wr.ID)
})
Expand Down
17 changes: 10 additions & 7 deletions workspace_run_task_integration_test.go
Expand Up @@ -12,7 +12,7 @@ import (
)

func TestWorkspaceRunTasksCreate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand All @@ -33,6 +33,10 @@ func TestWorkspaceRunTasksCreate(t *testing.T) {
})

require.NoError(t, err)
defer func() {
client.WorkspaceRunTasks.Delete(ctx, wkspaceTest.ID, wr.ID)
}()

assert.NotEmpty(t, wr.ID)
assert.Equal(t, wr.EnforcementLevel, Mandatory)

Expand All @@ -43,7 +47,7 @@ func TestWorkspaceRunTasksCreate(t *testing.T) {
}

func TestWorkspaceRunTasksList(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -77,7 +81,7 @@ func TestWorkspaceRunTasksList(t *testing.T) {
}

func TestWorkspaceRunTasksRead(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -112,7 +116,7 @@ func TestWorkspaceRunTasksRead(t *testing.T) {
}

func TestWorkspaceRunTasksUpdate(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -143,7 +147,7 @@ func TestWorkspaceRunTasksUpdate(t *testing.T) {
}

func TestWorkspaceRunTasksDelete(t *testing.T) {
skipIfBeta(t)
skipIfFreeOnly(t)

client := testClient(t)
ctx := context.Background()
Expand Down Expand Up @@ -173,8 +177,7 @@ func TestWorkspaceRunTasksDelete(t *testing.T) {
})

t.Run("when the workspace does not exist", func(t *testing.T) {
wkspaceTestCleanup()
err := client.WorkspaceRunTasks.Delete(ctx, wkspaceTest.ID, wrTaskTest.ID)
err := client.WorkspaceRunTasks.Delete(ctx, "does-not-exist", wrTaskTest.ID)
assert.EqualError(t, err, ErrResourceNotFound.Error())
})
}

0 comments on commit ea2578f

Please sign in to comment.