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 policyset list #497

Merged
merged 3 commits into from Aug 12, 2022

Conversation

Uk1288
Copy link
Contributor

@Uk1288 Uk1288 commented Aug 10, 2022

Description

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

@Uk1288 Uk1288 requested a review from a team as a code owner August 10, 2022 16:43
annawinkler
annawinkler previously approved these changes Aug 11, 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:

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 merged commit 198de9b into main Aug 12, 2022
@Uk1288 Uk1288 deleted the uk1288-add-include-param-to-policy-set-list branch August 12, 2022 18:36
@github-actions
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.

@brandonc brandonc mentioned this pull request Aug 16, 2022
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

2 participants