-
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 failing acceptance test for disk caching feature #26
Conversation
@@ -1,5 +1,5 @@ | |||
FROM bats/bats:v1.2.1 | |||
RUN apk --no-cache add ca-certificates parallel | |||
RUN apk --no-cache add ca-certificates parallel python |
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.
For running http server (serving schemas)
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 believe we could skip all this part with the python server by just putting a cache file at the right place with the right name?
} | ||
|
||
blockNetwork() { | ||
echo "nameserver 127.0.0.1" > /etc/resolv.conf |
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.
Block network by using non-existing DNS server
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 a bit brutal... I'd love a better way... I d love to try to find a way with unshare.
@@ -10,7 +10,8 @@ | |||
"type": "string" | |||
}, | |||
"metadata": { | |||
"type": "object" | |||
"$ref": "https://kubernetesjsonschema.dev/v1.14.0/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta", |
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.
The test fails without internet access because this file do not get cached
Wow that's pretty heavy duty... What exactly do you want to test - that if the schema is cached, the file can be validated even without internet connection? |
Yes, to be sure that cache is actually used, not only written to disk. Test is passing if I rollback the change in - "type": "object"
+ "$ref": "https://kubernetesjsonschema.dev/v1.14.0/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
+ "description": "Standard object metadata." |
What would you think of this approach https://github.com/yannh/kubeconform/pull/29/files ? Should accomplish something similar, but avoids setting up a python webserver - also runs the test really without network rather than with just a broken dns? |
No description provided.