-
Notifications
You must be signed in to change notification settings - Fork 141
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
Use Python's unittest for validating bundles and configurations? #98
Comments
I think it is the direction. There are three main tasks of ocitools in my mind:
|
On Sun, Jun 05, 2016 at 09:04:58PM -0700, 梁辰晔 (Liang Chenye) wrote:
Would you attribute the multi-version issues more to the spec shifting And I can't find configuration-validation logic in OCT for ‘readonly’.
That's about testing the runtime (e.g. is runC conformant?), and I
Yes, and the stuff I have there now uses features specific to Python
I agree that this would be nice to have, but I'm becoming increasingly a. Generating configurations based on command-line options (‘ocitools seem distinct enough that the benefit from a single binary does not |
Both. The spec changes so fast between 0.1 ~0.3 that our update had to be very fast accordingly.
Yes, it is just runtime validation. Sorry I did not explain clearly, I just want to make an analogy: |
On Sun, Jun 05, 2016 at 11:34:27PM -0700, 梁辰晔 (Liang Chenye) wrote:
Ugh. I'm not excited about maintaining old Go structures in the
Got it. And I agree that this is a useful goal for runtime testing as |
Currently we're using Go, which means it's hard to build a single validator that can process multiple versions of the spec, because you'd have to use tedious
interface{}
manipulation or load separate packages with structures for each supported version.We're also not using a test suite, which means it's hard to test multiple aspects of the configuration and report on several errors (the current code just dies on the first error).
By using Python's unittest, we get more convenient handling of generic JSON and an established test framework that doesn't need a lot of boilerplate. I've started working up this approach here if folks want to kick the tires. Examples of potentially tricky things and how this approach lets us handle them easily:
root.path
requirement (here).Example compact output with the current tip (wking/oci-runtime-config-validator@cd0facf0a. I still haven't finished
process
, later entries inconfig.md
or anything from the platform-specific files):and verbose output:
And with an unrecognized version:
This approach would also likely work fine in other languages and test frameworks that make it easy to handle generic JSON. I'm familiar with Python, but if the OCI community prefers a different language, I'm game to try. So:
runtimetest
(certainly a better choice for that than Python), and multi-language repositories can get awkward. The validation tasks (configuration validation and runtime validation) seem to decouple well, so I'd rather not stuff both into a single repository. But I can live with a single repo if it's the maintainer preference ;).The text was updated successfully, but these errors were encountered: