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

Simple first steps to create a framework on which to hang real functionality #1

Merged
merged 9 commits into from Jan 17, 2017

Conversation

exarkun
Copy link
Contributor

@exarkun exarkun commented Jan 16, 2017

This doesn't provide anything useful but it does provide something you can install, run tests on, and some classes which serve as obvious points for future expansion.

@codecov-io
Copy link

codecov-io commented Jan 16, 2017

Current coverage is 97.75% (diff: 97.75%)

No coverage report found for master at caa3433.

Powered by Codecov. Last update caa3433...da85cfa

Copy link

@wallrj wallrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @exarkun

Looks like a great start.

richard@drax:~/.../LeastAuthority/txkube (basics)$ TXKUBE_INTEGRATION_KUBERNETES_BASE_URL=https://192.0.2.100:8081/foo/bar trial txkube
txkube.test.test_memory
  KubernetesClientIntegrationTests
    test_interfaces ...                                                    [OK]
txkube.test.test_network
    test_interfaces ...                                                    [OK]

-------------------------------------------------------------------------------
Ran 2 tests in 0.002s

PASSED (successes=2)

Please answer or address my comments and then merge.

package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
install_requires=[
"twisted[tls]",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first attempt to install resulted in this error:

python setup.py.develop
...
Searching for pyasn1-modules
Reading https://pypi.python.org/simple/pyasn1-modules/
Downloading https://pypi.python.org/packages/66/54/3c0f81c62dcb9bc055b8740d81e6b2a8e4708e347a52af4114501bfd4e54/pyasn1_modules-0.0.8-py2.7.egg#md5=f03fff5bc43106475a64a1c34d4052d7
Best match: pyasn1-modules 0.0.8
Processing pyasn1_modules-0.0.8-py2.7.egg
creating /home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/pyasn1_modules-0.0.8-py2.7.egg
Extracting pyasn1_modules-0.0.8-py2.7.egg to /home/richard/.virtualenvs/txkube/lib/python2.7/site-packages
warning: develop: byte-compiling is disabled, skipping.

Adding pyasn1-modules 0.0.8 to easy-install.pth file

Installed /home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/pyasn1_modules-0.0.8-py2.7.egg
Searching for pyasn1
Downloading https://pypi.python.org/packages/60/32/7703bccdba05998e4ff04db5038a6695a93bedc45dcf491724b85b5db76a/pyasn1-modules-0.0.8.tar.gz#md5=178129bc7fbf07215c25230c5f053f81
Best match: pyasn1 modules-0.0.8
Processing pyasn1-modules-0.0.8.tar.gz
Writing /tmp/easy_install-azwnCM/pyasn1-modules-0.0.8/setup.cfg
Running pyasn1-modules-0.0.8/setup.py -q bdist_egg --dist-dir /tmp/easy_install-azwnCM/pyasn1-modules-0.0.8/egg-dist-tmp-ixAdms
warning: build_py: byte-compiling is disabled, skipping.

warning: install_lib: byte-compiling is disabled, skipping.

removing '/home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/pyasn1_modules-0.0.8-py2.7.egg' (and everything under it)
creating /home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/pyasn1_modules-0.0.8-py2.7.egg
Extracting pyasn1_modules-0.0.8-py2.7.egg to /home/richard/.virtualenvs/txkube/lib/python2.7/site-packages
warning: develop: byte-compiling is disabled, skipping.

pyasn1-modules 0.0.8 is already the active version in easy-install.pth

Installed /home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/pyasn1_modules-0.0.8-py2.7.egg
error: The 'pyasn1' distribution was not found and is required by service-identity

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing with pip install --editable . succeeded.
I guess it's a setuptools bug?
❓ Maybe add a note about recommended installation method to README

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird :/ My only guess is there was a transient network error while trying to find pyasn1? The PyPI project looks okay and I can download the wheel now... Apart from a random obscure pip bug I don't have any other guesses.


from twisted.web.resource import Resource

from treq.testing import RequestTraversalAgent
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I attempt to run the tests I get this error:

richard@drax:~/.../LeastAuthority/txkube (basics)$ trial txkube
txkube ...                                                              [ERROR]

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/trial/runner.py", line 602, in loadByNames
    things.append(self.findByName(name))
  File "/home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/trial/runner.py", line 406, in findByName
    return reflect.namedAny(name)
  File "/home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/python/reflect.py", line 301, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/home/richard/.virtualenvs/txkube/lib/python2.7/site-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/python/reflect.py", line 248, in _importAndCheckStack
    reraise(excValue, excTraceback)
  File "/home/richard/projects/LeastAuthority/txkube/src/txkube/__init__.py", line 21, in <module>
    from ._memory import memory_kubernetes
  File "/home/richard/projects/LeastAuthority/txkube/src/txkube/_memory.py", line 14, in <module>
    from treq.testing import RequestTraversalAgent
exceptions.ImportError: No module named treq.testing

txkube
-------------------------------------------------------------------------------
Ran 1 tests in 0.001s


def memory_kubernetes():
"""

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring.

],
extras_require={
"dev": [
"treq",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't read this carefully.
Add a note to README about how to run the tests.

pip install .
pip install txkube[dev]
trial txkube

"network_client", "memory_client",
]

from incremental import Version
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incremental should probably be listed as a direct dependency in setup.py then.

"deployment's API."
)

def client():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Missing docstring.

pass


class IKubernetesClient(Interface):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Missing docstring.

subset of the external Kubernetes API.
"""
def __init__(self):
base_url = URL.fromText(u"https://localhost/")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Maybe use some non-routable, documentation only IP address or unresolvable DNS name.

from incremental import Version

from ._metadata import version_tuple as _version_tuple
version = Version("pykube", *_version_tuple)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work:

python -c 'import txkube; print txkube.version'
[pykube, version 17.1.0]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, except I can't get out of the habit of typing pykube 👅

client = kubernetes.client()
verifyObject(IKubernetesClient, client)

return KubernetesClientIntegrationTests
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Not sure why this module is called integration? To me it implies a module containing slow integration tests. We'd call it txkube.testtools in Flocker, right? What's your latest thinking :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fast and local-only right now but I anticipate adding real-Kubernetes-interacting tests here once IKubernetesClient has expanded to support any such things.

@exarkun exarkun merged commit 70bcdb2 into master Jan 17, 2017
@exarkun exarkun deleted the basics branch January 17, 2017 14:44
exarkun pushed a commit that referenced this pull request Nov 10, 2017
Use assertNoResult instead of inlineCallbacks
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

3 participants