Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDE-3951 test(cli): fix failing tests in dependabot's PRs #762

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

eliangcs
Copy link
Member

@eliangcs eliangcs commented Mar 27, 2024

Mock ZAPIER_DEPLOY_KEY for RegisterCommand tests
commit ac29aa2

GitHub's dependabot doesn't have access to secrets. This is why dependabot's PRs have been failing. The tests in RegisterCommand don't really need the deploy key because they use nock to mock HTTP requests. But our callAPI() function always checks crendentials with readCredentials(); it isn't aware that the request may be "nocked" and won't require a deploy key.

This commit bypasses the checks in readCredentials() by setting a fake ZAPIER_DEPLOY_KEY before running the tests. Since the requests are "nocked", the fake deploy key won't be sent to Zapier anyway.


Replace DEPLOY_KEY with ZAPIER_DEPLOY_KEY in CLI smoke tests
commit 18b7ebc

It turns out our CI isn't running the smoke test for the zapier integrations command because DEPLOY_KEY has been always empty. The correct environment variable to use is ZAPIER_DEPLOY_KEY.


/api/platform/cli/apps/fields-choices doesn't need deploy key
commit d60711a

The fields-choices endpoint doesn't need a deploy key, so we can enable skipDeployKey in the request options.

The `fields-choices` endpoint doesn't need a deploy key, so we can
enable `skipDeployKey` in the request options.
It turns out our CI isn't running the smoke test for the `zapier integrations`
command because `DEPLOY_KEY` has been always empty. The correct
environment variable to use is `ZAPIER_DEPLOY_KEY`.
GitHub's dependabot [doesn't have access to secrets][1]. This is why
dependabot's PRs have been failing. The tests in RegisterCommand don't
really need the deploy key because they use nock to mock HTTP requests.
But our `callAPI()` function always checks crendentials with
`readCredentials()`; it isn't aware that the request may be "nocked" and
won't require a deploy key.

This commit bypasses the checks in `readCredentials()` the issue by
setting a fake ZAPIER_DEPLOY_KEY before running the tests. Since the
requests are "nocked", the fake deploy key won't be sent to Zapier
anyway.

[1]: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#accessing-secrets
@eliangcs eliangcs merged commit 1efbf56 into main Mar 28, 2024
13 checks passed
@eliangcs eliangcs deleted the PDE-3951-fix-dependabot-tests-fail branch March 28, 2024 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants