The Wayback Machine - https://web.archive.org/web/20210129183700/https://github.com/google/go-github/issues/98
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

Add integration tests #98

Open
willnorris opened this issue Apr 9, 2014 · 4 comments
Open

Add integration tests #98

willnorris opened this issue Apr 9, 2014 · 4 comments
Labels

Comments

@willnorris
Copy link
Collaborator

@willnorris willnorris commented Apr 9, 2014

This is an ongoing work item to add integration tests for the entire library. Unlike the existing unit tests that spin up a local HTTP server that mimics certain behavior of the API, these integration tests will call against the live GitHub API. As such, they will likely take a lot longer to execute and will not be run near as often. I've set things up with aff0a13 and will continue working from there.

I'm not 100% settled yet on how extensive these tests need to be. For example, we don't need to test the value of every field in a response. The biggest goal is to have a test suite that can be run when things like the default media type changes to make sure the library is still working properly. I also have a separate test suite that I'm working on to identify fields in responses that we aren't mapping into our Go structs.

willnorris added a commit that referenced this issue Apr 9, 2014
This is a breaking change, but it appears that this method has been
broken for some time now and no one has complained yet, so I'm going to
assume no one is using it yet.

Notably, this is also the first (of many, I'm sure) bug I've discovered
while working on the new integration tests (#98).  Yay for better tests!
@varadarajana
Copy link
Contributor

@varadarajana varadarajana commented Jan 1, 2017

I am new to go as well as go-github project. I am trying to set up the go repository and was able to run the basicauth example. How are the tests set up? I am unable to test the individual test files here. I am running these tests locally.

@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jan 3, 2017

the go repository

What repository exactly?

How are the tests set up? I am unable to test the individual test files here. I am running these tests locally.

The go-github project uses standard Go tests. They're inside the github.com/google/go-github/github package, so running go test github.com/google/go-github/github would run all the tests there.

I am new to go as well as go-github project.

Please see here for the best places to ask Go questions:

https://github.com/golang/go/wiki/Questions

@varadarajana
Copy link
Contributor

@varadarajana varadarajana commented Jan 4, 2017

I am sorry for spelling out the repository wrong. I am using the go-github repository.

After cloning the repository, i tried running the integration test cases in the tests/integration folder with GITHUB_AUTH_TOKEN set in environment.

Here is what I did from the GitHub folder
go get -t -v ./...
go test -v ../tests/integration/*

Here is the error I got

../tests/integration/repos_test.go:117: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:121: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:122: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:123: unknown github.RequiredStatusChecks field 'EnforcementLevel' in struct literal
../tests/integration/repos_test.go:126: client.Repositories.EditBranch undefined (type *github.RepositoriesService has no field or method EditBranch)
../tests/integration/repos_test.go:131: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:134: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:135: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:139: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:140: branch.Protection undefined (type *github.Branch has no field or method Protection)
../tests/integration/repos_test.go:140: too many errors
FAIL command-line-arguments [build failed]

Is the integration folder broken, can i raise an issue and try to solve?

All the tests in the GitHub folder of the go-github project passes. it is only the integration files that seem to be broken.

@dmitshur
Copy link
Member

@dmitshur dmitshur commented Jan 5, 2017

I am sorry for spelling out the repository wrong. I am using the go-github repository.

No problem, I just wanted to make sure I'm not misunderstanding you.

Is the integration folder broken, can i raise an issue and try to solve?

Yes, it is, I got the same errors. Please do. Open a new issue, and feel free to work on a PR to resolve it. The integration tests are run manually, so they got out of date after some breaking API changes in the library. Thanks!

By the way, don't forget to read over the integration tests README. You should run them with -tags=integration, instead of specifying individual .go files via *.

(Also, feel free to review PR #506 since it's related.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants