Skip to content

Commit

Permalink
internal/_e2e: rename CUE_LOGINS to CUE_TEST_LOGINS
Browse files Browse the repository at this point in the history
Whilst preparing to write a guide for the central registry, I was
examining the pattern used by the e2e tests for performing a headless
'cue login'. This led me to the CI setup, where the env var CUE_LOGINS
is set in order to control the behaviour of the e2e tests. Specifically,
the contents of CUE_LOGINS is written to $CUE_CONFIG_DIR/logins.json.

The naming of this environment variable is, however, rather unfortunate.
Because at first glance it's not clear it should only ever be used in a
test situation.

Rename CUE_LOGINS to CUE_TEST_LOGINS to make sure we don't regress and
ever use this environment variable for anything non-test.

Signed-off-by: Paul Jolly <paul@myitcv.io>
Change-Id: I0deec96b5bf13422b9ef23a80467ee8d55377233
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1185463
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@gmail.com>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
  • Loading branch information
myitcv committed Mar 21, 2024
1 parent 623b6a8 commit ec655a5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trybot.yml
Expand Up @@ -184,7 +184,7 @@ jobs:
Dispatch-Trailer: {"type":"')))) && (matrix.go-version == '1.22.x' && matrix.runner == 'ubuntu-22.04')
name: End-to-end test
env:
CUE_LOGINS: ${{ secrets.E2E_CUE_LOGINS }}
CUE_TEST_LOGINS: ${{ secrets.E2E_CUE_LOGINS }}
run: |-
cd internal/_e2e
go test -race
Expand Down
4 changes: 2 additions & 2 deletions internal/_e2e/script_test.go
Expand Up @@ -102,9 +102,9 @@ func TestScript(t *testing.T) {
configDir := filepath.Join(env.WorkDir, "tmp/configdir")
env.Setenv("CUE_CONFIG_DIR", configDir)

// CUE_LOGINS is a secret used by the scripts publishing to registry.cue.works.
// CUE_TEST_LOGINS is a secret used by the scripts publishing to registry.cue.works.
// When unset, those tests would fail with an auth error.
if logins := os.Getenv("CUE_LOGINS"); logins != "" {
if logins := os.Getenv("CUE_TEST_LOGINS"); logins != "" {
if err := os.MkdirAll(configDir, 0o777); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/_e2e/testdata/script/github_app_private.txtar
@@ -1,5 +1,5 @@
# Publish a CUE module under a private GitHub repository namespace
# where the $CUE_LOGINS tokens have full read-write access.
# where the $CUE_TEST_LOGINS tokens have full read-write access.
# Publish a version for this new repository with `cue mod publish`,
# and then fetch the module as a dependency via cmd/cue.

Expand Down
2 changes: 1 addition & 1 deletion internal/_e2e/testdata/script/github_app_public.txtar
@@ -1,5 +1,5 @@
# Publish a CUE module under a public GitHub repository namespace
# where the $CUE_LOGINS tokens have full read-write access.
# where the $CUE_TEST_LOGINS tokens have full read-write access.
# Publish a version for this new repository with `cue mod publish`,
# and then fetch the module as a dependency via cmd/cue.

Expand Down
2 changes: 1 addition & 1 deletion internal/ci/github/trybot.cue
Expand Up @@ -142,7 +142,7 @@ workflows: trybot: _repo.bashWorkflow & {
// on the entire cue-labs-modules-testing org. Note that porcuepine is also an org admin,
// since otherwise the repo admin access to create and delete repos does not work.
env: {
CUE_LOGINS: "${{ secrets.E2E_CUE_LOGINS }}"
CUE_TEST_LOGINS: "${{ secrets.E2E_CUE_LOGINS }}"
}
// Our regular tests run with both `go test ./...` and `go test -race ./...`.
// The end-to-end tests should only be run once, given the slowness and API rate limits.
Expand Down

0 comments on commit ec655a5

Please sign in to comment.