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

test: Fix failure in TestAccCredentialStoreVault #525

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

moduli
Copy link
Contributor

@moduli moduli commented Dec 13, 2023

ICU-11525

Originally, the test TestAccCredentialStoreVault was flaky for the following reason

=== RUN TestAccCredentialStoreVault
resource_credential_store_vault_test.go:101: Step 1/8 error: Error running apply: exit status 1
Error: error creating credential store: {"kind":"Internal", "message":"credentialstores.(Service).createInRepo: unable to create credential store: vault.(Repository).CreateCredentialStore: unable to lookup vault token: vault.(client).lookupToken: vault: http://localhost:32796: unknown: error #0: Error making API request.\n\nURL: GET http://localhost:32796/v1/auth/token/lookup-self\nCode: 400. Raw Message:\n\nClient sent an HTTP request to an HTTPS server.\n"}
with boundary_credential_store_vault.example,
on terraform_plugin_test.tf line 44, in resource "boundary_credential_store_vault" "example":
44: resource "boundary_credential_store_vault" "example" {

After pulling in boundary 0.14.3, which included this fix: hashicorp/boundary#3973, the test started to always fail for the following reason

resource_credential_store_vault_test.go:101: Step 3/8 error: Error running apply: exit status 1
Error: error updating credential store: {"kind":"Internal","message":"credentialstores.(Service).updateInRepo: unable to update credential store: vault.(Repository).UpdateCredentialStore: cannot lookup token for updated store: vault.(client).lookupToken: vault: https://localhost:32800: unknown: error #0: Get "https://localhost:32800/v1/auth/token/lookup-self\": tls: failed to verify certificate: x509: certificate is valid for localhost, not www.updated.com"}
with boundary_credential_store_vault.example,
on terraform_plugin_test.tf line 44, in resource "boundary_credential_store_vault" "example":
44: resource "boundary_credential_store_vault" "example" {

So, I think 0.14.3 included a fix for the original flaky behavior, but then exposed an issue with the test (the test server sets up a certificate that's only valid for localhost, but we're setting the server name to be www.updated.com).

This PR also includes an adjustment in the GitHub Action to disable caching in the setup-go step. We already handle caching in the Set up Go modules cache step, and without this adjustment, we were getting duplicate caching, resulting in errors like

Error: /usr/bin/tar: ../../../go/pkg/mod/go.mongodb.org/[email protected]/version/version.go: Cannot open: File exists
Error: /usr/bin/tar: ../../../go/pkg/mod/go.mongodb.org/[email protected]/bson/bsontype/bsontype_test.go: Cannot open: File exists
Error: /usr/bin/tar: ../../../go/pkg/mod/go.mongodb.org/[email protected]/bson/bsontype/bsontype.go: Cannot open: File exists

@moduli moduli requested review from mgaffney and elimt December 13, 2023 22:43
Copy link
Member

@elimt elimt left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this so quickly!

@moduli moduli merged commit 212d64a into main Dec 14, 2023
7 checks passed
@moduli moduli deleted the moduli-TestAccCredentialSourceVault branch December 14, 2023 14:41
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.

3 participants