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 ExpiredAt to Organization, Team, User Authentication Tokens #672

Merged
merged 15 commits into from
May 9, 2023

Conversation

juliannatetreault
Copy link
Contributor

@juliannatetreault juliannatetreault commented Mar 30, 2023

Description

Adds ExpiredAt to Organization, Team, and User tokens and updates the accompanying tests. This is part of a larger change which adds a time-to-live to API authentication tokens.

Testing plan

  1. Verify that you can set the properties by using go-tfe within the TFE provider.
  2. Verify that all tests still pass.

Output from tests

team_token_integration_test.go results:

=== RUN   TestTeamTokensCreate
--- PASS: TestTeamTokensCreate (2.31s)
=== RUN   TestTeamTokensCreate/with_valid_options
    --- PASS: TestTeamTokensCreate/with_valid_options (0.21s)
=== RUN   TestTeamTokensCreate/when_a_token_already_exists
    --- PASS: TestTeamTokensCreate/when_a_token_already_exists (0.26s)
=== RUN   TestTeamTokensCreate/without_valid_team_ID
    --- PASS: TestTeamTokensCreate/without_valid_team_ID (0.00s)
PASS

Process finished with the exit code 0

...

=== RUN   TestTeamTokens_CreateWithOptions
--- PASS: TestTeamTokens_CreateWithOptions (2.54s)
=== RUN   TestTeamTokens_CreateWithOptions/with_valid_options
    --- PASS: TestTeamTokens_CreateWithOptions/with_valid_options (0.21s)
=== RUN   TestTeamTokens_CreateWithOptions/when_a_token_already_exists
    --- PASS: TestTeamTokens_CreateWithOptions/when_a_token_already_exists (0.22s)
=== RUN   TestTeamTokens_CreateWithOptions/without_valid_team_ID
    --- PASS: TestTeamTokens_CreateWithOptions/without_valid_team_ID (0.00s)
=== RUN   TestTeamTokens_CreateWithOptions/without_an_expiration_date
    --- PASS: TestTeamTokens_CreateWithOptions/without_an_expiration_date (0.22s)
=== RUN   TestTeamTokens_CreateWithOptions/with_an_expiration_date
    --- PASS: TestTeamTokens_CreateWithOptions/with_an_expiration_date (0.21s)
PASS

Process finished with the exit code 0

...

=== RUN   TestTeamTokensRead
--- PASS: TestTeamTokensRead (3.31s)
=== RUN   TestTeamTokensRead/with_valid_options
    --- PASS: TestTeamTokensRead/with_valid_options (0.65s)
=== RUN   TestTeamTokensRead/with_an_expiration_date_passed_as_a_valid_option
    --- PASS: TestTeamTokensRead/with_an_expiration_date_passed_as_a_valid_option (0.65s)
=== RUN   TestTeamTokensRead/when_a_token_doesn't_exists
    --- PASS: TestTeamTokensRead/when_a_token_doesn't_exists (0.20s)
=== RUN   TestTeamTokensRead/without_valid_organization
    --- PASS: TestTeamTokensRead/without_valid_organization (0.00s)
PASS

Process finished with the exit code 0

organization_token_integration_test.go results:

=== RUN   TestOrganizationTokensCreate
--- PASS: TestOrganizationTokensCreate (1.62s)
=== RUN   TestOrganizationTokensCreate/with_valid_options
    --- PASS: TestOrganizationTokensCreate/with_valid_options (0.22s)
=== RUN   TestOrganizationTokensCreate/when_a_token_already_exists
    --- PASS: TestOrganizationTokensCreate/when_a_token_already_exists (0.21s)
=== RUN   TestOrganizationTokensCreate/without_valid_organization
    --- PASS: TestOrganizationTokensCreate/without_valid_organization (0.00s)
PASS

Process finished with the exit code 0

...

=== RUN   TestOrganizationTokens_CreateWithOptions
--- PASS: TestOrganizationTokens_CreateWithOptions (2.15s)
=== RUN   TestOrganizationTokens_CreateWithOptions/with_valid_options
    --- PASS: TestOrganizationTokens_CreateWithOptions/with_valid_options (0.25s)
=== RUN   TestOrganizationTokens_CreateWithOptions/when_a_token_already_exists
    --- PASS: TestOrganizationTokens_CreateWithOptions/when_a_token_already_exists (0.26s)
=== RUN   TestOrganizationTokens_CreateWithOptions/without_valid_organization
    --- PASS: TestOrganizationTokens_CreateWithOptions/without_valid_organization (0.00s)
=== RUN   TestOrganizationTokens_CreateWithOptions/without_an_expiration_date
    --- PASS: TestOrganizationTokens_CreateWithOptions/without_an_expiration_date (0.21s)
=== RUN   TestOrganizationTokens_CreateWithOptions/with_an_expiration_date
    --- PASS: TestOrganizationTokens_CreateWithOptions/with_an_expiration_date (0.21s)
PASS

Process finished with the exit code 0

...

=== RUN   TestOrganizationTokensRead
--- PASS: TestOrganizationTokensRead (2.60s)
=== RUN   TestOrganizationTokensRead/with_valid_options
    --- PASS: TestOrganizationTokensRead/with_valid_options (0.64s)
=== RUN   TestOrganizationTokensRead/with_an_expiration_date_passed_as_a_valid_option
    --- PASS: TestOrganizationTokensRead/with_an_expiration_date_passed_as_a_valid_option (0.63s)
=== RUN   TestOrganizationTokensRead/when_a_token_doesn't_exists
    --- PASS: TestOrganizationTokensRead/when_a_token_doesn't_exists (0.19s)
=== RUN   TestOrganizationTokensRead/without_valid_organization
    --- PASS: TestOrganizationTokensRead/without_valid_organization (0.00s)
PASS

Process finished with the exit code 0

user_token_integration_test.go results:

=== RUN   TestUserTokens_Create
--- PASS: TestUserTokens_Create (2.24s)
=== RUN   TestUserTokens_Create/create_token_with_no_description
    --- PASS: TestUserTokens_Create/create_token_with_no_description (0.27s)
=== RUN   TestUserTokens_Create/create_token_with_description
    --- PASS: TestUserTokens_Create/create_token_with_description (0.21s)
=== RUN   TestUserTokens_Create/create_token_without_an_expiration_date
    --- PASS: TestUserTokens_Create/create_token_without_an_expiration_date (0.19s)
=== RUN   TestUserTokens_Create/create_token_with_an_expiration_date
    --- PASS: TestUserTokens_Create/create_token_with_an_expiration_date (0.19s)
PASS

Process finished with the exit code 0

organization_token.go Show resolved Hide resolved
organization_token_integration_test.go Show resolved Hide resolved
team_token.go Show resolved Hide resolved
user_token.go Outdated Show resolved Hide resolved
@juliannatetreault juliannatetreault force-pushed the juliannatetreault/add-expiry-to-auth-tokens branch from 0d22df7 to 931db0d Compare April 5, 2023 19:21
organization_token.go Outdated Show resolved Hide resolved
team_token.go Outdated Show resolved Hide resolved
organization_token_integration_test.go Show resolved Hide resolved
@juliannatetreault juliannatetreault force-pushed the juliannatetreault/add-expiry-to-auth-tokens branch from fe42f7b to 80b4c73 Compare April 6, 2023 19:45
helper_test.go Outdated Show resolved Hide resolved
helper_test.go Outdated Show resolved Hide resolved
organization_token.go Show resolved Hide resolved
@juliannatetreault juliannatetreault force-pushed the juliannatetreault/add-expiry-to-auth-tokens branch from c41f298 to 061e1bc Compare April 18, 2023 19:08
JarrettSpiker
JarrettSpiker previously approved these changes Apr 19, 2023
Copy link
Contributor

@JarrettSpiker JarrettSpiker left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just a few additional suggested assertions

organization_token_integration_test.go Show resolved Hide resolved
team_token_integration_test.go Show resolved Hide resolved
user_token_integration_test.go Show resolved Hide resolved
JarrettSpiker
JarrettSpiker previously approved these changes May 5, 2023
Copy link
Contributor

@JarrettSpiker JarrettSpiker left a comment

Choose a reason for hiding this comment

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

Just a few corrections on the TFE release, but looks good to me!

CHANGELOG.md Outdated Show resolved Hide resolved
organization_token.go Outdated Show resolved Hide resolved
team_token.go Outdated Show resolved Hide resolved
user_token.go Outdated Show resolved Hide resolved
uturunku1
uturunku1 previously approved these changes May 8, 2023
Copy link
Collaborator

@uturunku1 uturunku1 left a comment

Choose a reason for hiding this comment

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

I see that these are our first CreateWithOptions methods! 😄
Too bad that those two create signature methods did include CreateOptions originally.
When you get chance, can you remove the links to the RFC and JIRA from the PR description? I think my team has a preference for not including internal links in our open source projects 🤔

organization_token.go Outdated Show resolved Hide resolved
@juliannatetreault
Copy link
Contributor Author

When you get chance, can you remove the links to the RFC and JIRA from the PR description? I think my team has a preference for not including internal links in our open source projects 🤔

Oh, good to know! I've updated the PR description, @uturunku1 😊

uturunku1
uturunku1 previously approved these changes May 8, 2023
@juliannatetreault juliannatetreault merged commit db09c87 into main May 9, 2023
10 checks passed
@juliannatetreault juliannatetreault deleted the juliannatetreault/add-expiry-to-auth-tokens branch May 9, 2023 17:55
@github-actions
Copy link

github-actions bot commented May 9, 2023

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.

None yet

4 participants