Closed stream-aha closed 7 years ago
I am unable to run test. I see the following error.
ERROR: These tests require that env var GITHUB_OAUTH_TOKEN be set to a GitHub Personal Access Token.
See the tests cases to see which GitHub repos the oAuth token needs access to.
exit status 1
FAIL _/home/amir/git/amirhammad/gocode/fetch 0.003s
Could you help?
As the error message says, you need to set the GITHUB_OAUTH_TOKEN
environment variable. Follow these instructions to get a token. Expose it as an env var as follows:
export GITHUB_OAUTH_TOKEN=(your token)
Then run the tests.
Note that the tests that access private GitHub repos in the gruntwork-io repo will fail; you can ignore those.
Thank you for your help. I added two commits. Output of the command go test
is:
--- FAIL: TestDownloadReleaseAsset (0.62s)
github_test.go:191: Failed to download asset %!s(int=1872521) to /tmp/test-download-release-asset839253382 from GitHub URL https://github.com/gruntwork-io/fetch-test-private due to error: 401 - Received HTTP Response 401 while fetching releases for GitHub URL https://github.com/gruntwork-io/fetch-test-private. Full HTTP response: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}
--- FAIL: TestGetGitHubReleaseInfo (0.63s)
github_test.go:155: Failed to fetch GitHub release info for repo aa33a due to error: 401 - Received HTTP Response 401 while fetching releases for GitHub URL https://github.com/gruntwork-io/fetch-test-private. Full HTTP response: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}
--- FAIL: TestGetListOfReleasesFromGitHubRepo (0.91s)
github_test.go:29: error fetching releases: 401 - Received HTTP Response 401 while fetching releases for GitHub URL https://github.com/gruntwork-io/fetch-test-private. Full HTTP response: {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}
--- FAIL: TestDownloadGitBranchZipFile (0.78s)
file_test.go:80: Failed to download file: 500 - Failed to download file at the url https://api.github.com/repos/gruntwork-io/fetch-test-private/zipball/sample-branch. Received HTTP Response 401.
--- FAIL: TestDownloadGitTagZipFile (0.56s)
file_test.go:46: Failed to download file: 500 - Failed to download file at the url https://api.github.com/repos/gruntwork-io/fetch-test-private/zipball/v0.0.2. Received HTTP Response 401.
--- FAIL: TestDownloadGitCommitFile (1.70s)
file_test.go:145: Failed to download file: 500 - Failed to download file at the url https://api.github.com/repos/gruntwork-io/fetch-test-private/zipball/676cfb92b54d33538c756c7a9479bfc3f6b44de2. Received HTTP Response 401.
FAIL
exit status 1
FAIL _/home/amir/git/amirhammad/gocode/fetch 2.330s
If the CI tests pass, I'll create a new release of fetch
, and you'll be able to grab new binaries there.
Maybe using some CI tool, you can at least show status of those tests here in github pull requests. TOKEN can be stored encrypted in the repository and then decrypted by the CI to run tests (shippable, travis, other?). Thank you for a great tool
Looks great, guys. Just don't forget to update the README.md
to clarify that fetch now supports downloading a specific tag.
This is a PR according to the specifications designed in issue https://github.com/gruntwork-io/fetch/issues/16