Skip to content

Instantly share code, notes, and snippets.

@slayer321
Created June 16, 2021 17:31
Show Gist options
  • Save slayer321/b2b1dd1f68ce3a83732731f3177b7874 to your computer and use it in GitHub Desktop.
Save slayer321/b2b1dd1f68ce3a83732731f3177b7874 to your computer and use it in GitHub Desktop.
testing

I did both the testing as it was mention is the test dir

For integration test

➜  test git:(i1881-support-auto-merge) go test -v -tags=integration ./integration
!!! Skipping test because the required environment variable (GITHUB_USERNAME) is not present. !!!

!!! Skipping test because the required environment variable (GITHUB_PASSWORD) is not present. !!!

!!! Skipping test because the required environment variable (GITHUB_CLIENT_ID) is not present. !!!

!!! Skipping test because the required environment variable (GITHUB_CLIENT_SECRET) is not present. !!!

=== RUN   TestActivity_Starring
    activity_test.go:44: Already starring google/go-github. Please manually unstar it first.
--- FAIL: TestActivity_Starring (1.01s)
=== RUN   TestActivity_Watching
--- PASS: TestActivity_Watching (1.74s)
=== RUN   TestOrganizationAuditLog
    audit_log_test.go:23: Organizations.GetAuditLog returned error: GET https://api.github.com/orgs/example_org/audit-log: 404 Not Found []
--- FAIL: TestOrganizationAuditLog (0.25s)
=== RUN   TestAuthorizationsAppOperations
    authorizations_test.go:196: Skipping test because the required environment variable (GITHUB_CLIENT_ID) is not present.
--- SKIP: TestAuthorizationsAppOperations (0.00s)
=== RUN   TestIssueEvents
--- PASS: TestIssueEvents (1.84s)
=== RUN   TestEmojis
--- PASS: TestEmojis (0.47s)
=== RUN   TestAPIMeta
    misc_test.go:47: APIMeta VerifiablePasswordAuthentication is false
--- FAIL: TestAPIMeta (0.27s)
=== RUN   TestRateLimits
--- PASS: TestRateLimits (0.27s)
=== RUN   TestListServiceHooks
    misc_test.go:74: ListServiceHooks returned error: GET https://api.github.com/hooks: 404 Not Found []
--- FAIL: TestListServiceHooks (0.25s)
=== RUN   TestPullRequests_ListCommits
--- PASS: TestPullRequests_ListCommits (0.41s)
=== RUN   TestRepositories_CRUD
    repos_test.go:49: Repositories.Delete() returned error: DELETE https://api.github.com/repos/slayer321/test-6129484611666145821: 403 Must have admin rights to Repository. []
--- FAIL: TestRepositories_CRUD (3.13s)
=== RUN   TestRepositories_BranchesTags
--- PASS: TestRepositories_BranchesTags (0.98s)
=== RUN   TestRepositories_EditBranches
    repos_test.go:107: Repositories.GetBranch() returned error: GET https://api.github.com/repositories/slayer321/test-4037200794235010051/branches/main: 404 Not Found []
--- FAIL: TestRepositories_EditBranches (2.33s)
=== RUN   TestRepositories_List
--- PASS: TestRepositories_List (2.34s)
=== RUN   TestRepositories_DownloadReleaseAsset
--- PASS: TestRepositories_DownloadReleaseAsset (1.44s)
=== RUN   TestUsers_Get
--- PASS: TestUsers_Get (0.56s)
=== RUN   TestUsers_Update
    users_test.go:76: Users.Update returned error: PATCH https://api.github.com/user: 404 Not Found []
--- FAIL: TestUsers_Update (0.54s)
=== RUN   TestUsers_Emails
    users_test.go:104: Users.ListEmails() returned error: GET https://api.github.com/user/emails: 404 Not Found []
--- FAIL: TestUsers_Emails (0.23s)
=== RUN   TestUsers_Keys
    users_test.go:181: Users.ListKeys('') returned error: GET https://api.github.com/user/keys: 404 Not Found []
--- FAIL: TestUsers_Keys (0.48s)
FAIL
FAIL	github.com/google/go-github/v35/test/integration	18.557s
FAIL

For Fields Test

➜  test git:(i1881-support-auto-merge) go run ./fields/fields.go
*github.User missing field for key: hireable (example value: <nil>)
*github.User missing field for key: twitter_username (example value: <nil>)
*github.User missing field for key: bio (example value: <nil>)
*github.User missing field for key: email (example value: <nil>)
*github.User missing field for key: hireable (example value: <nil>)
*github.User missing field for key: company (example value: <nil>)
*github.Organization missing field for key: twitter_username (example value: <nil>)
*github.Organization missing field for key: name (example value: <nil>)
*github.Organization missing field for key: blog (example value: <nil>)
*github.Organization missing field for key: company (example value: <nil>)
*github.Organization missing field for key: location (example value: <nil>)
*github.Organization missing field for key: email (example value: <nil>)
*github.Repository missing field for key: mirror_url (example value: <nil>)
*github.Repository missing field for key: temp_clone_token (example value: )
*github.Repository missing field for key: open_issues (example value: 71)
*github.Repository missing field for key: forks (example value: 1534)
*github.Repository missing field for key: watchers (example value: 7537)
*github.Issue missing field for key: active_lock_reason (example value: <nil>)
*github.Issue missing field for key: milestone (example value: <nil>)
*github.Issue missing field for key: performed_via_github_app (example value: <nil>)
error: GET https://api.github.com/gists/9257657: 502 Server Error []


this are both output that i got

@gmlewis
Copy link

gmlewis commented Jun 16, 2021

Oh! I understand now. Yes, the integrations test needs a special key... you can effectively ignore it.

Please come up with a brand new test that just tests your new feature and run it separately to try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment