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

Add failing acceptance test for disk caching feature #26

Closed
wants to merge 1 commit into from

Conversation

Nitive
Copy link

@Nitive Nitive commented Jan 7, 2021

No description provided.

@@ -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
Copy link
Author

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)

Copy link
Owner

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
Copy link
Author

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

Copy link
Owner

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",
Copy link
Author

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

@Nitive Nitive mentioned this pull request Jan 7, 2021
@yannh
Copy link
Owner

yannh commented Jan 7, 2021

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?

@Nitive
Copy link
Author

Nitive commented Jan 8, 2021

Yes, to be sure that cache is actually used, not only written to disk. Test is passing if I rollback the change in fixtures/registry/trainingjob-sagemaker-v1.json

- "type": "object"
+ "$ref": "https://kubernetesjsonschema.dev/v1.14.0/_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
+ "description": "Standard object metadata."

@yannh
Copy link
Owner

yannh commented Jan 8, 2021

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?

@Nitive Nitive closed this Jan 9, 2021
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

2 participants