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

Go-Tfe support for creating test variables #787

Merged
merged 10 commits into from
Oct 10, 2023
Merged

Conversation

aaabdelgany
Copy link
Contributor

Description

This PR adds support for consuming environment variables for remote terraform tests. It contains a full test suite.

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.

go test -run TestTestVariables -v
=== RUN   TestTestVariablesList
=== RUN   TestTestVariablesList/without_list_options
=== RUN   TestTestVariablesList/empty_list_options
=== RUN   TestTestVariablesList/with_page_size
--- PASS: TestTestVariablesList (6.52s)
    --- PASS: TestTestVariablesList/without_list_options (0.22s)
    --- PASS: TestTestVariablesList/empty_list_options (0.20s)
    --- PASS: TestTestVariablesList/with_page_size (0.30s)
=== RUN   TestTestVariablesCreate
=== RUN   TestTestVariablesCreate/with_valid_options
=== RUN   TestTestVariablesCreate/when_options_has_an_empty_string_value
=== RUN   TestTestVariablesCreate/when_options_has_an_empty_string_description
=== RUN   TestTestVariablesCreate/when_options_has_a_too-long_description
=== RUN   TestTestVariablesCreate/when_options_is_missing_value
=== RUN   TestTestVariablesCreate/when_options_is_missing_key
=== RUN   TestTestVariablesCreate/when_options_has_an_empty_key
=== RUN   TestTestVariablesCreate/when_options_is_missing_category
--- PASS: TestTestVariablesCreate (5.68s)
    --- PASS: TestTestVariablesCreate/with_valid_options (0.31s)
    --- PASS: TestTestVariablesCreate/when_options_has_an_empty_string_value (0.22s)
    --- PASS: TestTestVariablesCreate/when_options_has_an_empty_string_description (0.23s)
    --- PASS: TestTestVariablesCreate/when_options_has_a_too-long_description (0.18s)
    --- PASS: TestTestVariablesCreate/when_options_is_missing_value (0.20s)
    --- PASS: TestTestVariablesCreate/when_options_is_missing_key (0.00s)
    --- PASS: TestTestVariablesCreate/when_options_has_an_empty_key (0.00s)
    --- PASS: TestTestVariablesCreate/when_options_is_missing_category (0.00s)
=== RUN   TestTestVariablesUpdate
=== RUN   TestTestVariablesUpdate/with_valid_options
=== RUN   TestTestVariablesUpdate/when_updating_a_subset_of_values
=== RUN   TestTestVariablesUpdate/with_sensitive_set
=== RUN   TestTestVariablesUpdate/without_any_changes
=== RUN   TestTestVariablesUpdate/with_invalid_variable_ID
--- PASS: TestTestVariablesUpdate (9.16s)
    --- PASS: TestTestVariablesUpdate/with_valid_options (0.21s)
    --- PASS: TestTestVariablesUpdate/when_updating_a_subset_of_values (0.25s)
    --- PASS: TestTestVariablesUpdate/with_sensitive_set (0.21s)
    --- PASS: TestTestVariablesUpdate/without_any_changes (2.84s)
    --- PASS: TestTestVariablesUpdate/with_invalid_variable_ID (0.00s)
=== RUN   TestTestVariablesDelete
=== RUN   TestTestVariablesDelete/with_valid_options
=== RUN   TestTestVariablesDelete/with_non_existing_variable_ID
=== RUN   TestTestVariablesDelete/with_invalid_variable_ID
--- PASS: TestTestVariablesDelete (5.28s)
    --- PASS: TestTestVariablesDelete/with_valid_options (0.29s)
    --- PASS: TestTestVariablesDelete/with_non_existing_variable_ID (0.18s)
    --- PASS: TestTestVariablesDelete/with_invalid_variable_ID (0.00s)
PASS
ok  	github.com/hashicorp/go-tfe	26.840s

@aaabdelgany aaabdelgany requested a review from hashimoon October 9, 2023 21:21
@aaabdelgany aaabdelgany requested a review from a team as a code owner October 9, 2023 21:21
@aaabdelgany aaabdelgany changed the title Go-Tfe support for creating testable variables Go-Tfe support for creating test variables Oct 9, 2023
Copy link
Member

@nfagerlund nfagerlund left a comment

Choose a reason for hiding this comment

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

OK, this all seems pretty good to me, and I got those beta tests to pass locally.

@aaabdelgany aaabdelgany merged commit f08e4b0 into main Oct 10, 2023
@aaabdelgany aaabdelgany deleted the abdu/testing_variables branch October 10, 2023 14:56
@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.

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.

2 participants