Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add workspace auto destroy duration field #902

Merged
merged 1 commit into from
May 22, 2024

Conversation

notchairmk
Copy link
Member

Description

Adds an auto_destroy_activity_duration field to Workspaces (see API docs). Makes use of jsonapi.NullableAttr because this is an optional string field, but we will want to be able to send an explicit null to unset.

Testing plan

  1. Run auto destroy tests, confirm that they're valid envchain go-tfe go test -run "TestWorkspacesAutoDestroy.*" -v ./...

External links

Output from tests

Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.

$ TFE_ADDRESS="https://example" TFE_TOKEN="example" go test ./... -v -run "TestWorkspacesAutoDestroy.*"

?   	github.com/hashicorp/go-tfe/examples/backing_data	[no test files]
?   	github.com/hashicorp/go-tfe/examples/configuration_versions	[no test files]
?   	github.com/hashicorp/go-tfe/examples/organizations	[no test files]
?   	github.com/hashicorp/go-tfe/examples/registry_modules	[no test files]
?   	github.com/hashicorp/go-tfe/examples/run_errors	[no test files]
?   	github.com/hashicorp/go-tfe/examples/state_versions	[no test files]
?   	github.com/hashicorp/go-tfe/examples/users	[no test files]
?   	github.com/hashicorp/go-tfe/examples/workspaces	[no test files]
?   	github.com/hashicorp/go-tfe/mocks	[no test files]
=== RUN   TestWorkspacesAutoDestroy
--- PASS: TestWorkspacesAutoDestroy (4.72s)
=== RUN   TestWorkspacesAutoDestroyDuration
--- PASS: TestWorkspacesAutoDestroyDuration (3.85s)
PASS
ok  	github.com/hashicorp/go-tfe	9.099s
...

@notchairmk notchairmk requested a review from a team May 21, 2024 13:48
@notchairmk notchairmk requested a review from a team as a code owner May 21, 2024 13:48
@@ -2747,7 +2748,7 @@ func TestWorkspacesAutoDestroy(t *testing.T) {
})
t.Cleanup(wCleanup)

require.Equal(t, wTest.AutoDestroyAt, autoDestroyAt)
require.Equal(t, autoDestroyAt, wTest.AutoDestroyAt)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swapped the order on these since require wants require.Equal(t, <expected>, <actual>)

workspace.go Outdated Show resolved Hide resolved
@hashicorp hashicorp deleted a comment from notchairmk May 21, 2024
brandonc
brandonc previously approved these changes May 21, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
@notchairmk notchairmk force-pushed the notchairmk/workspace-auto-destroy-duration branch from 1db4eea to 8531617 Compare May 21, 2024 22:10
@brandonc brandonc merged commit 26e5760 into main May 22, 2024
5 of 7 checks passed
@brandonc brandonc deleted the notchairmk/workspace-auto-destroy-duration branch May 22, 2024 00:01
Copy link

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants