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

Add SpeculativeEnabled attribute to workspace #132

Merged
merged 2 commits into from
Sep 23, 2020
Merged

Add SpeculativeEnabled attribute to workspace #132

merged 2 commits into from
Sep 23, 2020

Conversation

jgiannuzzi
Copy link
Contributor

@jgiannuzzi jgiannuzzi commented Aug 27, 2020

Description

This change allows to read and set the SpeculativeEnabled property on workspaces. I would like to add support for that property to terraform-provider-tfe, and adding it here is the first step.

Fixes #133

Testing plan

The tests have been updated to test this in the same way that FileTriggersEnabled is tested.
FileTriggersEnabled also defaults to true during workspace creation and is thus quite comparable.

External links

Output from tests

$ go test -run TestWorkspaces -v ./...
=== RUN   TestWorkspacesList
=== RUN   TestWorkspacesList/without_list_options
=== RUN   TestWorkspacesList/with_list_options
=== RUN   TestWorkspacesList/when_searching_a_known_workspace
=== RUN   TestWorkspacesList/when_searching_an_unknown_workspace
=== RUN   TestWorkspacesList/without_a_valid_organization
--- PASS: TestWorkspacesList (3.11s)
    --- PASS: TestWorkspacesList/without_list_options (0.17s)
    --- PASS: TestWorkspacesList/with_list_options (0.48s)
    --- PASS: TestWorkspacesList/when_searching_a_known_workspace (0.19s)
    --- PASS: TestWorkspacesList/when_searching_an_unknown_workspace (0.63s)
    --- PASS: TestWorkspacesList/without_a_valid_organization (0.00s)
=== RUN   TestWorkspacesCreate
=== RUN   TestWorkspacesCreate/with_valid_options
=== RUN   TestWorkspacesCreate/when_options_is_missing_name
=== RUN   TestWorkspacesCreate/when_options_has_an_invalid_name
=== RUN   TestWorkspacesCreate/when_options_has_an_invalid_organization
=== RUN   TestWorkspacesCreate/when_an_error_is_returned_from_the_api
--- PASS: TestWorkspacesCreate (0.98s)
    --- PASS: TestWorkspacesCreate/with_valid_options (0.29s)
    --- PASS: TestWorkspacesCreate/when_options_is_missing_name (0.00s)
    --- PASS: TestWorkspacesCreate/when_options_has_an_invalid_name (0.00s)
    --- PASS: TestWorkspacesCreate/when_options_has_an_invalid_organization (0.00s)
    --- PASS: TestWorkspacesCreate/when_an_error_is_returned_from_the_api (0.12s)
=== RUN   TestWorkspacesRead
=== RUN   TestWorkspacesRead/when_the_workspace_exists
=== RUN   TestWorkspacesRead/when_the_workspace_exists/permissions_are_properly_decoded
=== RUN   TestWorkspacesRead/when_the_workspace_exists/relationships_are_properly_decoded
=== RUN   TestWorkspacesRead/when_the_workspace_exists/timestamps_are_properly_decoded
=== RUN   TestWorkspacesRead/when_the_workspace_does_not_exist
=== RUN   TestWorkspacesRead/when_the_organization_does_not_exist
=== RUN   TestWorkspacesRead/without_a_valid_organization
=== RUN   TestWorkspacesRead/without_a_valid_workspace
--- PASS: TestWorkspacesRead (1.90s)
    --- PASS: TestWorkspacesRead/when_the_workspace_exists (0.13s)
        --- PASS: TestWorkspacesRead/when_the_workspace_exists/permissions_are_properly_decoded (0.00s)
        --- PASS: TestWorkspacesRead/when_the_workspace_exists/relationships_are_properly_decoded (0.00s)
        --- PASS: TestWorkspacesRead/when_the_workspace_exists/timestamps_are_properly_decoded (0.00s)
    --- PASS: TestWorkspacesRead/when_the_workspace_does_not_exist (0.13s)
    --- PASS: TestWorkspacesRead/when_the_organization_does_not_exist (0.42s)
    --- PASS: TestWorkspacesRead/without_a_valid_organization (0.00s)
    --- PASS: TestWorkspacesRead/without_a_valid_workspace (0.00s)
=== RUN   TestWorkspacesReadByID
=== RUN   TestWorkspacesReadByID/when_the_workspace_exists
=== RUN   TestWorkspacesReadByID/when_the_workspace_exists/permissions_are_properly_decoded
=== RUN   TestWorkspacesReadByID/when_the_workspace_exists/relationships_are_properly_decoded
=== RUN   TestWorkspacesReadByID/when_the_workspace_exists/timestamps_are_properly_decoded
=== RUN   TestWorkspacesReadByID/when_the_workspace_does_not_exist
=== RUN   TestWorkspacesReadByID/without_a_valid_workspace_ID
--- PASS: TestWorkspacesReadByID (1.45s)
    --- PASS: TestWorkspacesReadByID/when_the_workspace_exists (0.14s)
        --- PASS: TestWorkspacesReadByID/when_the_workspace_exists/permissions_are_properly_decoded (0.00s)
        --- PASS: TestWorkspacesReadByID/when_the_workspace_exists/relationships_are_properly_decoded (0.00s)
        --- PASS: TestWorkspacesReadByID/when_the_workspace_exists/timestamps_are_properly_decoded (0.00s)
    --- PASS: TestWorkspacesReadByID/when_the_workspace_does_not_exist (0.12s)
    --- PASS: TestWorkspacesReadByID/without_a_valid_workspace_ID (0.00s)
=== RUN   TestWorkspacesUpdate
=== RUN   TestWorkspacesUpdate/when_updating_a_subset_of_values
=== RUN   TestWorkspacesUpdate/with_valid_options
=== RUN   TestWorkspacesUpdate/when_an_error_is_returned_from_the_api
=== RUN   TestWorkspacesUpdate/when_options_has_an_invalid_name
=== RUN   TestWorkspacesUpdate/when_options_has_an_invalid_organization
--- PASS: TestWorkspacesUpdate (1.34s)
    --- PASS: TestWorkspacesUpdate/when_updating_a_subset_of_values (0.16s)
    --- PASS: TestWorkspacesUpdate/with_valid_options (0.30s)
    --- PASS: TestWorkspacesUpdate/when_an_error_is_returned_from_the_api (0.12s)
    --- PASS: TestWorkspacesUpdate/when_options_has_an_invalid_name (0.00s)
    --- PASS: TestWorkspacesUpdate/when_options_has_an_invalid_organization (0.00s)
=== RUN   TestWorkspacesUpdateByID
=== RUN   TestWorkspacesUpdateByID/when_updating_a_subset_of_values
=== RUN   TestWorkspacesUpdateByID/with_valid_options
=== RUN   TestWorkspacesUpdateByID/when_an_error_is_returned_from_the_api
=== RUN   TestWorkspacesUpdateByID/without_a_valid_workspace_ID
--- PASS: TestWorkspacesUpdateByID (1.52s)
    --- PASS: TestWorkspacesUpdateByID/when_updating_a_subset_of_values (0.19s)
    --- PASS: TestWorkspacesUpdateByID/with_valid_options (0.35s)
    --- PASS: TestWorkspacesUpdateByID/when_an_error_is_returned_from_the_api (0.14s)
    --- PASS: TestWorkspacesUpdateByID/without_a_valid_workspace_ID (0.00s)
=== RUN   TestWorkspacesDelete
=== RUN   TestWorkspacesDelete/with_valid_options
=== RUN   TestWorkspacesDelete/when_organization_is_invalid
=== RUN   TestWorkspacesDelete/when_workspace_is_invalid
--- PASS: TestWorkspacesDelete (1.46s)
    --- PASS: TestWorkspacesDelete/with_valid_options (0.63s)
    --- PASS: TestWorkspacesDelete/when_organization_is_invalid (0.00s)
    --- PASS: TestWorkspacesDelete/when_workspace_is_invalid (0.00s)
=== RUN   TestWorkspacesDeleteByID
=== RUN   TestWorkspacesDeleteByID/with_valid_options
=== RUN   TestWorkspacesDeleteByID/without_a_valid_workspace_ID
--- PASS: TestWorkspacesDeleteByID (1.44s)
    --- PASS: TestWorkspacesDeleteByID/with_valid_options (0.62s)
    --- PASS: TestWorkspacesDeleteByID/without_a_valid_workspace_ID (0.00s)
=== RUN   TestWorkspacesRemoveVCSConnection
    TestWorkspacesRemoveVCSConnection: helper_test.go:269: Export a valid GITHUB_TOKEN before running this test!
--- SKIP: TestWorkspacesRemoveVCSConnection (0.58s)
=== RUN   TestWorkspacesRemoveVCSConnectionByID
    TestWorkspacesRemoveVCSConnectionByID: helper_test.go:269: Export a valid GITHUB_TOKEN before running this test!
--- SKIP: TestWorkspacesRemoveVCSConnectionByID (0.55s)
=== RUN   TestWorkspacesLock
=== RUN   TestWorkspacesLock/with_valid_options
=== RUN   TestWorkspacesLock/when_workspace_is_already_locked
=== RUN   TestWorkspacesLock/without_a_valid_workspace_ID
--- PASS: TestWorkspacesLock (1.09s)
    --- PASS: TestWorkspacesLock/with_valid_options (0.18s)
    --- PASS: TestWorkspacesLock/when_workspace_is_already_locked (0.12s)
    --- PASS: TestWorkspacesLock/without_a_valid_workspace_ID (0.00s)
=== RUN   TestWorkspacesUnlock
=== RUN   TestWorkspacesUnlock/with_valid_options
=== RUN   TestWorkspacesUnlock/when_workspace_is_already_unlocked
=== RUN   TestWorkspacesUnlock/without_a_valid_workspace_ID
--- PASS: TestWorkspacesUnlock (1.21s)
    --- PASS: TestWorkspacesUnlock/with_valid_options (0.16s)
    --- PASS: TestWorkspacesUnlock/when_workspace_is_already_unlocked (0.14s)
    --- PASS: TestWorkspacesUnlock/without_a_valid_workspace_ID (0.00s)
=== RUN   TestWorkspacesForceUnlock
=== RUN   TestWorkspacesForceUnlock/with_valid_options
=== RUN   TestWorkspacesForceUnlock/when_workspace_is_already_unlocked
=== RUN   TestWorkspacesForceUnlock/without_a_valid_workspace_ID
--- PASS: TestWorkspacesForceUnlock (1.20s)
    --- PASS: TestWorkspacesForceUnlock/with_valid_options (0.16s)
    --- PASS: TestWorkspacesForceUnlock/when_workspace_is_already_unlocked (0.13s)
    --- PASS: TestWorkspacesForceUnlock/without_a_valid_workspace_ID (0.00s)
=== RUN   TestWorkspacesAssignSSHKey
=== RUN   TestWorkspacesAssignSSHKey/with_valid_options
=== RUN   TestWorkspacesAssignSSHKey/without_an_SSH_key_ID
=== RUN   TestWorkspacesAssignSSHKey/without_a_valid_SSH_key_ID
=== RUN   TestWorkspacesAssignSSHKey/without_a_valid_workspace_ID
--- PASS: TestWorkspacesAssignSSHKey (1.33s)
    --- PASS: TestWorkspacesAssignSSHKey/with_valid_options (0.18s)
    --- PASS: TestWorkspacesAssignSSHKey/without_an_SSH_key_ID (0.00s)
    --- PASS: TestWorkspacesAssignSSHKey/without_a_valid_SSH_key_ID (0.00s)
    --- PASS: TestWorkspacesAssignSSHKey/without_a_valid_workspace_ID (0.00s)
=== RUN   TestWorkspacesUnassignSSHKey
=== RUN   TestWorkspacesUnassignSSHKey/with_valid_options
=== RUN   TestWorkspacesUnassignSSHKey/without_a_valid_workspace_ID
--- PASS: TestWorkspacesUnassignSSHKey (1.51s)
    --- PASS: TestWorkspacesUnassignSSHKey/with_valid_options (0.17s)
    --- PASS: TestWorkspacesUnassignSSHKey/without_a_valid_workspace_ID (0.00s)
PASS
ok  	github.com/hashicorp/go-tfe	20.777s
?   	github.com/hashicorp/go-tfe/examples/organizations	[no test files]
?   	github.com/hashicorp/go-tfe/examples/workspaces	[no test files]

@jgiannuzzi jgiannuzzi requested a review from a team August 27, 2020 17:23
@hashicorp-cla
Copy link

hashicorp-cla commented Aug 27, 2020

CLA assistant check
All committers have signed the CLA.

@jgiannuzzi jgiannuzzi changed the title Add SpeculativeEnabled property to workspace Add SpeculativeEnabled attribute to workspace Sep 1, 2020
@jgiannuzzi
Copy link
Contributor Author

Hi @lafentres @apparentlymart @radditude, could you please review this PR?

It is fairly trivial in terms of code, but is quite important for us to be able to set speculative-enabled on TFE workspaces through terraform-provider (see related PR hashicorp/terraform-provider-tfe#210).

Thanks!

@lafentres
Copy link
Contributor

Hey @jgiannuzzi!
Sorry for the delay - we're working through all of the open PRs and issues at the moment and will get to this as soon as we can. Thanks for your patience!

Copy link
Contributor

@koikonom koikonom left a comment

Choose a reason for hiding this comment

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

Hi @jgiannuzzi, thanks for submitting this PR. LGTM!

@koikonom koikonom merged commit 38c2cef into hashicorp:master Sep 23, 2020
@jgiannuzzi
Copy link
Contributor Author

Thanks for the merge, @koikonom!

Any idea when the next release could be made?

I'm waiting for this feature to make it into a go-tfe release so that hashicorp/terraform-provider-tfe#210 can be merged next.

Thanks!

@koikonom
Copy link
Contributor

I am planning to discuss this with the rest of the team today, and I will let you know as soon as we're ready to move on.

@jgiannuzzi jgiannuzzi deleted the add-workspace-speculative-enabled branch September 23, 2020 18:51
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.

Add SpeculativeEnabled attribute to workspace
4 participants