-
Notifications
You must be signed in to change notification settings - Fork 116
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 test for refs caching #30
Conversation
@test "Cache not only original schema but also refs to other schemas" { | ||
run bin/kubeconform -schema-location './fixtures/registry/{{ .ResourceKind }}{{ .KindSuffix }}-with-ref.json' fixtures/test_crd.yaml | ||
[ "$status" -eq 0 ] | ||
[ "`ls cache/ | wc -l`" -eq 1 ] |
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.
Actual value is 0 because no refs got cached
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 think the better test would be
- Run kubeconform with internet access
- Disable network
- Run kubeconform again and check that status hasn't changed
But then we need to block network somehow. Maybe with DNS hack or somehow better
"metadata": { | ||
"$ref": "https://kubernetesjsonschema.dev/v1.14.0/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta", | ||
"description": "Standard object metadata." | ||
}, |
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.
Almost the same file as trainingjob-sagemaker-v1.json with such change:
"metadata": {
- "type": "object",
+ "$ref": "https://kubernetesjsonschema.dev/v1.14.0/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
+ "description": "Standard object metadata."
},
yep that ll need patching gojsonschema.. might have a look, some day :) |
BTW thanks a lot for filing that bug xeipuuv/gojsonschema#322 👍 |
Closing, it looks like gojsonschema is not very actively maintained... and this will be fairly difficult to complete :( |
not sure what the point of a cache is if it can't be used offline |
The problem with refs caching lays in gojsonschema code. There is a GET request which can't be cached on kubeconform side.
I think the best solution for caching refs would be to have http transport with supports caching and pass it to gojsonschema