Conversation
* Find Terraform binaries that we've already downloaded instead of repeatedly downloading them * Read a TF_LOG_INSTALLER environment variable to log hc-install activity. Works best with a branch of hc-install that prepends log levels to logged messages. * What if? Could provider installation be optimized? Before: ``` $ time go test ./tfversion -count=1 ok github.com/hashicorp/terraform-plugin-testing/tfversion 223.588s go test ./tfversion -count=1 45.66s user 29.61s system 33% cpu 3:44.32 total ``` After: ``` $ time go test ./tfversion -count=1 ok github.com/hashicorp/terraform-plugin-testing/tfversion 58.465s go test ./tfversion -count=1 22.14s user 12.61s system 58% cpu 58.982 total ```
bbasata
commented
Apr 24, 2025
| Version: tfVersion, | ||
| }) | ||
| } | ||
| sources = append(sources, findSource, releasesSource) |
Collaborator
Author
There was a problem hiding this comment.
This is the part that makes this faster. Instead of a "releases source," use a "find source" and a "releases source."
bbasata
commented
Apr 24, 2025
| strings.TrimRight(tempDir, string(os.PathSeparator)), | ||
| "plugintest-terraform", | ||
| strconv.Itoa(os.Getpid()), | ||
| tfVersion.String(), |
Collaborator
Author
There was a problem hiding this comment.
One directory per-version, per-process.
ok github.com/hashicorp/terraform-plugin-testing/tfversion 16.360s TF_LOG_INSTALLER=info go test -v ./tfversion 25.66s user 14.50s system 236% cpu 16.969 total
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For fun, not to be merged.
The
tfversiontests are fairly unique in that they specify"TF_ACC_TERRAFORM_VERSION". As a consequence, each of these tests downloads Terraform into its own temporary directory. This PR asks: what if they shared one temporary directory?TF_LOG_INSTALLERenvironment variable to log hc-install activity. Works best with a branch of hc-install that prepends log levels to logged messages.Before:
After: