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 Include param to Policy set list #494

Closed
wants to merge 15 commits into from

Conversation

Uk1288
Copy link
Contributor

@Uk1288 Uk1288 commented Aug 9, 2022

Description

!!! Moved to: #497

This PR adds the Include param field to PolicySetListOptions to allow policy list to include related resource data such as workspaces, policies, newest_version, or current_version.

Testing plan

  1. Fetch list of policy sets with Include param set to workspace should return list items with attached workspace object

External links

API doc

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" TF_ACC="1" go test ./... -v -tags=integration -run TestPolicySets

=== RUN   TestPolicySetsList
=== RUN   TestPolicySetsList/without_list_options
=== RUN   TestPolicySetsList/with_pagination
=== RUN   TestPolicySetsList/with_search
=== RUN   TestPolicySetsList/with_include_param
=== RUN   TestPolicySetsList/without_a_valid_organization
--- PASS: TestPolicySetsList (2.62s)
    --- PASS: TestPolicySetsList/without_list_options (0.16s)
    --- PASS: TestPolicySetsList/with_pagination (0.14s)
    --- PASS: TestPolicySetsList/with_search (0.17s)
    --- PASS: TestPolicySetsList/with_include_param (0.18s)
    --- PASS: TestPolicySetsList/without_a_valid_organization (0.00s)
=== RUN   TestPolicySetsCreate
=== RUN   TestPolicySetsCreate/with_valid_attributes
=== RUN   TestPolicySetsCreate/with_all_attributes_provided
=== RUN   TestPolicySetsCreate/with_policies_and_workspaces_provided
=== RUN   TestPolicySetsCreate/with_vcs_policy_set
    helper_test.go:445: Export a valid OAUTH_CLIENT_GITHUB_TOKEN before running this test!
=== RUN   TestPolicySetsCreate/with_vcs_policy_updated
    helper_test.go:445: Export a valid OAUTH_CLIENT_GITHUB_TOKEN before running this test!
=== RUN   TestPolicySetsCreate/without_a_name_provided
=== RUN   TestPolicySetsCreate/with_an_invalid_name_provided
=== RUN   TestPolicySetsCreate/without_a_valid_organization
--- PASS: TestPolicySetsCreate (2.15s)
    --- PASS: TestPolicySetsCreate/with_valid_attributes (0.14s)
    --- PASS: TestPolicySetsCreate/with_all_attributes_provided (0.15s)
    --- PASS: TestPolicySetsCreate/with_policies_and_workspaces_provided (0.78s)
    --- SKIP: TestPolicySetsCreate/with_vcs_policy_set (0.00s)
    --- SKIP: TestPolicySetsCreate/with_vcs_policy_updated (0.00s)
    --- PASS: TestPolicySetsCreate/without_a_name_provided (0.00s)
    --- PASS: TestPolicySetsCreate/with_an_invalid_name_provided (0.00s)
    --- PASS: TestPolicySetsCreate/without_a_valid_organization (0.00s)
=== RUN   TestPolicySetsRead
=== RUN   TestPolicySetsRead/with_a_valid_ID
=== RUN   TestPolicySetsRead/without_a_valid_ID
=== RUN   TestPolicySetsRead/with_policy_set_version
--- PASS: TestPolicySetsRead (2.33s)
    --- PASS: TestPolicySetsRead/with_a_valid_ID (0.11s)
    --- PASS: TestPolicySetsRead/without_a_valid_ID (0.00s)
    --- PASS: TestPolicySetsRead/with_policy_set_version (0.93s)
=== RUN   TestPolicySetsUpdate
=== RUN   TestPolicySetsUpdate/with_valid_attributes
=== RUN   TestPolicySetsUpdate/with_invalid_attributes
=== RUN   TestPolicySetsUpdate/without_a_valid_ID
--- PASS: TestPolicySetsUpdate (1.42s)
    --- PASS: TestPolicySetsUpdate/with_valid_attributes (0.14s)
    --- PASS: TestPolicySetsUpdate/with_invalid_attributes (0.00s)
    --- PASS: TestPolicySetsUpdate/without_a_valid_ID (0.00s)
=== RUN   TestPolicySetsAddPolicies
=== RUN   TestPolicySetsAddPolicies/with_policies_provided
=== RUN   TestPolicySetsAddPolicies/without_policies_provided
=== RUN   TestPolicySetsAddPolicies/with_empty_policies_slice
=== RUN   TestPolicySetsAddPolicies/without_a_valid_ID
--- PASS: TestPolicySetsAddPolicies (2.29s)
    --- PASS: TestPolicySetsAddPolicies/with_policies_provided (0.24s)
    --- PASS: TestPolicySetsAddPolicies/without_policies_provided (0.00s)
    --- PASS: TestPolicySetsAddPolicies/with_empty_policies_slice (0.00s)
    --- PASS: TestPolicySetsAddPolicies/without_a_valid_ID (0.00s)
=== RUN   TestPolicySetsRemovePolicies
=== RUN   TestPolicySetsRemovePolicies/with_policies_provided
=== RUN   TestPolicySetsRemovePolicies/without_policies_provided
=== RUN   TestPolicySetsRemovePolicies/with_empty_policies_slice
=== RUN   TestPolicySetsRemovePolicies/without_a_valid_ID
--- PASS: TestPolicySetsRemovePolicies (2.03s)
    --- PASS: TestPolicySetsRemovePolicies/with_policies_provided (0.24s)
    --- PASS: TestPolicySetsRemovePolicies/without_policies_provided (0.00s)
    --- PASS: TestPolicySetsRemovePolicies/with_empty_policies_slice (0.00s)
    --- PASS: TestPolicySetsRemovePolicies/without_a_valid_ID (0.00s)
=== RUN   TestPolicySetsAddWorkspaces
=== RUN   TestPolicySetsAddWorkspaces/with_workspaces_provided
=== RUN   TestPolicySetsAddWorkspaces/without_workspaces_provided
=== RUN   TestPolicySetsAddWorkspaces/with_empty_workspaces_slice
=== RUN   TestPolicySetsAddWorkspaces/without_a_valid_ID
--- PASS: TestPolicySetsAddWorkspaces (2.16s)
    --- PASS: TestPolicySetsAddWorkspaces/with_workspaces_provided (0.31s)
    --- PASS: TestPolicySetsAddWorkspaces/without_workspaces_provided (0.00s)
    --- PASS: TestPolicySetsAddWorkspaces/with_empty_workspaces_slice (0.00s)
    --- PASS: TestPolicySetsAddWorkspaces/without_a_valid_ID (0.00s)
=== RUN   TestPolicySetsRemoveWorkspaces
=== RUN   TestPolicySetsRemoveWorkspaces/with_workspaces_provided
=== RUN   TestPolicySetsRemoveWorkspaces/without_workspaces_provided
=== RUN   TestPolicySetsRemoveWorkspaces/with_empty_workspaces_slice
=== RUN   TestPolicySetsRemoveWorkspaces/without_a_valid_ID
--- PASS: TestPolicySetsRemoveWorkspaces (2.13s)
    --- PASS: TestPolicySetsRemoveWorkspaces/with_workspaces_provided (0.24s)
    --- PASS: TestPolicySetsRemoveWorkspaces/without_workspaces_provided (0.00s)
    --- PASS: TestPolicySetsRemoveWorkspaces/with_empty_workspaces_slice (0.00s)
    --- PASS: TestPolicySetsRemoveWorkspaces/without_a_valid_ID (0.00s)
=== RUN   TestPolicySetsDelete
=== RUN   TestPolicySetsDelete/with_valid_options
=== RUN   TestPolicySetsDelete/when_the_policy_does_not_exist
=== RUN   TestPolicySetsDelete/when_the_policy_ID_is_invalid
--- PASS: TestPolicySetsDelete (1.72s)
    --- PASS: TestPolicySetsDelete/with_valid_options (0.21s)
    --- PASS: TestPolicySetsDelete/when_the_policy_does_not_exist (0.10s)
    --- PASS: TestPolicySetsDelete/when_the_policy_ID_is_invalid (0.00s)
PASS

@@ -245,6 +266,8 @@ func TestPolicySetsRead(t *testing.T) {
orgTest, orgTestCleanup := createOrganization(t, client)
defer orgTestCleanup()

upgradeOrganizationSubscription(t, client, orgTest)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the upgradeOrganizationSubscription in all policy set test. Prior to adding this, the policy set was all failing with resource not found on my dev.

@annawinkler
Copy link
Contributor

Hi @Uk1288 - do we have API docs that can be linked into the PR description?

@Uk1288
Copy link
Contributor Author

Uk1288 commented Aug 10, 2022

Hi @Uk1288 - do we have API docs that can be linked into the PR description?

Yes we do, I have added the link to the PR description.

annawinkler
annawinkler previously approved these changes Aug 10, 2022
Copy link
Contributor

@annawinkler annawinkler left a comment

Choose a reason for hiding this comment

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

:shipit:

@Uk1288 Uk1288 force-pushed the uk1288-add-include-to-policy-set-list branch from 61b3ce3 to 7faaf12 Compare August 10, 2022 16:35
@Uk1288
Copy link
Contributor Author

Uk1288 commented Aug 10, 2022

Ignore the commits in the PR, opening a new PR in progress

@Uk1288
Copy link
Contributor Author

Uk1288 commented Aug 10, 2022

Moved to: #497

@Uk1288 Uk1288 closed this Aug 10, 2022
@annawinkler annawinkler deleted the uk1288-add-include-to-policy-set-list branch February 2, 2023 14:34
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.

None yet

3 participants