fix(integration-test): run the search and reference tests without the GitHub login - #241
Merged
Merged
Conversation
… GitHub login All integration tests depended on testOAuthLogin, which signs in to github.com with the CI account's password and a TOTP code. GitHub often answers that login with a two-factor prompt or a checkup page, and the 24 dependent tests were then skipped. The 21 search, issue/PR reference and code reference tests only read public data, so they now store the workflow's GITHUB_TOKEN as the test user's personal token, restoring the previous token afterwards so the OAuth-dependent tests are unaffected. The integration workflow requests a read-only token and passes it to PHPUnit. Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
1 task
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.
Every integration test depended on
testOAuthLogin, which signs in to github.com with the CI account's password and a TOTP code. When GitHub answers that login with a two-factor prompt or a checkup page, the login test fails or is skipped, and PHPUnit then skips all 24 tests that depend on it. On pull requests opened by Dependabot the account secrets are not available at all, so every test is skipped and the job still reports success.The search and reference tests use the workflow token
The 21 tests for repository and issue search, issue and pull request references, and code permalinks only read public
nextcloud/serverdata, so they no longer depend on the OAuth login. Each test stores the token GitHub Actions issues to the workflow run as the test user's personal access token, and restores the user's previous token afterwards, so the OAuth, notification and token revocation tests keep the token the OAuth flow stored, whatever order the tests run in. The tests are skipped whenGITHUB_TOKENis not set.The integration workflow passes a read-only token
The workflow requests
contents: readfor its token and passesGITHUB_TOKENto the PHPUnit step.🤖 AI (if applicable)