test(e2e): embed short commit SHA in cli-e2e- prefix#842
Draft
natalie-o-perret wants to merge 1 commit into
Draft
test(e2e): embed short commit SHA in cli-e2e- prefix#842natalie-o-perret wants to merge 1 commit into
natalie-o-perret wants to merge 1 commit into
Conversation
fd1bfdd to
1244c4e
Compare
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.
Description
PR #841 made the
cli-e2e-prefix the single source of truth for naming API e2e test resources. This PR embeds the short commit SHA of the CLI repo into the prefix so any leaked resource in the portal can be traced straight back to the commit that created it.Concrete change:
TEST_RUN_IDis nowcli-e2e-<short-sha>-<unix>-<rand6>instead ofcli-e2e-<unix>-<rand6>. So an NLB is now namedcli-e2e-abc1234-1717000000-xyz789-nlb-a. Ongit logforabc1234you get the commit; on that commit's page, you get the PR.The SHA is resolved at test startup with
git rev-parse --short HEAD. If git is not onPATHor the working copy is not inside a git repository, the helper returnsunknownand the prefix stays well-formed rather than failing the suite.Related issue
Follow-up to #841.
Changes
tests/e2e/testscript_api_test.go:runIDnow includes the short SHA. Added ashortSHAhelper that walks up to find the repo root and shells out to git. Falls back tounknownon failure.tests/e2e/README.md: documents the newcli-e2e-<short-sha>-<unix>-<rand6>shape.CHANGELOG.md: entry under Unreleased.Checklist
Testing
go vet ./...andgo vet -tags=api ./...fromtests/e2e/pass.go build ./...andgo build -tags=api ./...fromtests/e2e/pass.shortSHAhelper standalone in a one-off Go program; returned the expected 8-char SHA (git returns longer than 7 chars when the 7-char prefix is ambiguous).I have not run the actual
-tags=apiscenarios because they needEXOSCALE_API_KEYandEXOSCALE_API_SECRET. CI is the source of truth for the full run.Notes for reviewers
git rev-parse --shortis intentionally left unconstrained on length. Git will return 7 chars by default and grow the short form automatically if 7 chars are ambiguous, which is the right behaviour.unknownfallback is for environments where git is not installed (e.g. some minimal CI images). Thecli-e2e-prefix is preserved in that case, so collision protection from test(e2e): prefix all API test resource names with cli-e2e- #841 still works.