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

Tests fail without Internet access #737

Closed
mgorny opened this issue Nov 21, 2017 · 1 comment
Closed

Tests fail without Internet access #737

mgorny opened this issue Nov 21, 2017 · 1 comment

Comments

@mgorny
Copy link
Contributor

mgorny commented Nov 21, 2017

We are running tests for our packages with blocked Internet access. The following tests in pygit2 fail:

======================================================================
ERROR: test_user_pass (test.test_credentials.CallableCredentialTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_credentials.py", line 108, in test_user_pass
    remote.fetch(callbacks=callbacks)
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1-python2_7/lib/pygit2/remote.py", line 375, in fetch
    check_error(err)
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1-python2_7/lib/pygit2/errors.py", line 64, in check_error
    raise GitError(message)
GitError: curl error: Could not resolve: bitbucket.org (Could not contact DNS servers)


======================================================================
ERROR: test_bad_cred_type (test.test_credentials.CredentialCallback)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_credentials.py", line 98, in test_bad_cred_type
    self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks()))
  File "/usr/lib64/python2.7/unittest/case.py", line 473, in assertRaises
    callableObj(*args, **kwargs)
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_credentials.py", line 98, in <lambda>
    self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks()))
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1-python2_7/lib/pygit2/remote.py", line 375, in fetch
    check_error(err)
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1-python2_7/lib/pygit2/errors.py", line 64, in check_error
    raise GitError(message)
GitError: curl error: Could not resolve: github.com (Could not contact DNS servers)


======================================================================
ERROR: test_clone_with_credentials (test.test_repository.CloneRepositoryTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_repository.py", line 579, in test_clone_with_credentials
    self._temp_dir, callbacks=pygit2.RemoteCallbacks(credentials=pygit2.UserPass("libgit2", "libgit2")))
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1-python2_7/lib/pygit2/__init__.py", line 258, in clone_repository
    check_error(err)
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1-python2_7/lib/pygit2/errors.py", line 64, in check_error
    raise GitError(message)
GitError: curl error: Could not resolve: bitbucket.org (Could not contact DNS servers)


======================================================================
ERROR: test_init_and_update (test.test_submodule.SubmoduleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_submodule.py", line 80, in test_init_and_update
    self.repo.update_submodules()
GitError: curl error: Could not resolve: github.com (Could not contact DNS servers)


======================================================================
ERROR: test_oneshot_update (test.test_submodule.SubmoduleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_submodule.py", line 93, in test_oneshot_update
    self.repo.update_submodules(init=True)
GitError: curl error: Could not resolve: github.com (Could not contact DNS servers)


======================================================================
ERROR: test_specified_update (test.test_submodule.SubmoduleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_submodule.py", line 87, in test_specified_update
    self.repo.update_submodules(submodules=['submodule'])
GitError: curl error: Could not resolve: github.com (Could not contact DNS servers)


======================================================================
ERROR: test_submodule_open (test.test_submodule.SubmoduleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/pygit2-0.26.1/work/pygit2-0.26.1/test/test_submodule.py", line 59, in test_submodule_open
    self.repo.update_submodules()
GitError: curl error: Could not resolve: github.com (Could not contact DNS servers)


----------------------------------------------------------------------
Ran 316 tests in 20.687s

FAILED (errors=7)

Running tests against remote servers is generally a bad idea. Besides them being unreliable (failing randomly due to service outages or network problems), the user may be running a byte-counted data plan in which the tests unnecessarily increase his expenditures and cause privacy issues. We have those reasons enumerated in Gentoo developer manual.

Please make it easily possible to disable the tests requiring network access, or possibly replace them with variants that work locally.

@jdavid jdavid closed this as completed in fe0e3ec Nov 22, 2017
@jdavid
Copy link
Member

jdavid commented Nov 22, 2017

Fixed, now the tests will be automatically skipped if there's no network.
Me too I would prefer versions of tests that don't require network, but that's much more work, will have to wait.
Thanks for reporting.

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

No branches or pull requests

2 participants