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
Conversation
Current coverage is 97.75% (diff: 97.75%)
|
There was a problem hiding this 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]", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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(): | ||
""" | ||
|
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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/") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
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.
Muscle memory...
We do not anticipate ever sending any traffic to this since this is the in-memory-only implementation.
Use assertNoResult instead of inlineCallbacks
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.