fix: align INTERNAL_ACCESS_TOKEN in user_integration_test.env with CI test env#3
Open
circleci-app[bot] wants to merge 1 commit into
Open
fix: align INTERNAL_ACCESS_TOKEN in user_integration_test.env with CI test env#3circleci-app[bot] wants to merge 1 commit into
circleci-app[bot] wants to merge 1 commit into
Conversation
… test env
The integration tests were failing because the USER_INTERNAL_ACCESS_TOKEN
passed to the test runner (internal-access-token) did not match the
INTERNAL_ACCESS_TOKEN configured in the user-service environment
(Fqn0m0HQ0gXydRtBCg5l).
When the test called /user/v1/admin/create with the wrong token, the
user-service rejected the request, the admin user was never created, and
the subsequent login call in setupAdminUser() threw an error — causing
all tests in before() to fail silently (mocha-junit-reporter writes to
XML, not stdout).
Fix by setting INTERNAL_ACCESS_TOKEN=internal-access-token in
user_integration_test.env to match the value passed via CI environment
variable USER_INTERNAL_ACCESS_TOKEN, as documented in the commonTests.js
comment ("Must match INTERNAL_ACCESS_TOKEN in user_integration_test.env").
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.
Summary
INTERNAL_ACCESS_TOKENindev-ops/user_integration_test.env(Fqn0m0HQ0gXydRtBCg5l) did not match theUSER_INTERNAL_ACCESS_TOKENpassed to the test runner in the CI config (internal-access-token).setupAdminUser()called/user/v1/admin/createwith the wrong token, the user-service rejected the request (unauthorized). The admin user was never created, so the subsequent login call threw — causing all tests to fail in thebefore()hook.mocha-junit-reporterwrites results to the XML file rather than stdout, the CI log showed a blank output block with no visible error, making the failure hard to diagnose.Fix
Changed
INTERNAL_ACCESS_TOKEN=Fqn0m0HQ0gXydRtBCg5l→INTERNAL_ACCESS_TOKEN=internal-access-tokenindev-ops/user_integration_test.envso the user-service accepts the token the tests actually send. ThecommonTests.jshelper already documents: "Must match INTERNAL_ACCESS_TOKEN in user_integration_test.env".Test plan
User Creation Flow > Admin usertests create/login successfullyUser Creation Flow > Regular usertests create/login successfullyOriginal failing job
https://app.circleci.com/agents/circleci/3c4df9e5-2e07-4dba-99a6-6a869f03d07e/chat/e6cc964b-fba8-4bbd-93e0-60a38ec87043