-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add initial conformance test #193
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
Conversation
grantr
left a comment
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'm so happy to have this! Requesting changes because the uploadtestimages.sh script doesn't work from the repo root. Everything else is minor nits.
test/conformance/README.md
Outdated
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.
Grammar nit: seems like there's a missing use here. I'd also add "kubeconfig file" for clarity and consistency with earlier docs.
The tests will use a
.kubeconfigfile to determine ...
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 like there's a missing use here
hah!
I'd also add "kubeconfig file" for clarity and consistency with earlier docs.
Added!
test/conformance/README.md
Outdated
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.
Grammar nit: article/plural disagreement. I have two suggestions, neither of which is perfect:
A set of built and pushed conformance test images
☝️ could imply there's a specific set of things
All built and pushed conformance test images
☝️ How do I know I have them all?
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.
Changed to:
A docker repo containing the built and pushed conformance test images.
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.
oh oh oh now that we don't need to mention the namespace anymore, i think it can be even simpler:
Your docker repo at DOCKER_REPO_OVERRIDE should contain the conformance test images.
test/conformance/README.md
Outdated
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.
Would be nice to have an example value for $MY_TEST_SUBSET here. Could add it above:
export MY_TEST_SUBSET=function_scaling
ginkgo generate $MY_TEST_SUBSETAlso, Kubernetes doc guidelines specify that code snippets shouldn't include command prompts.
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 like it!
Thanks for the link to the k8s doc guidelines, I'll try to remove all the command prompts. (I have one confusion with this: sometimes examples are running in certain dirs, it's nice to have some kind of indication of where they expect to be running. Not sure how to handle that without displaying the command prompt, any ides?)
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 guess my answer to that would be one of:
- Don't make the user change directories (every command is documented as running from the repo root)
- Add a preceding step telling the user to change directories
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.
Don't make the user change directories (every command is documented as running from the repo root)
kk, will do, thanks!
test/conformance/README.md
Outdated
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.
Could alternately put the example spec group name here, to correlate it with the CUJ name.
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.
even better!
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 for linking to the explanatory issue! I agree this is mysterious.
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.
test/README.md
Outdated
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.
Typo nit: "conformance"
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.
😅
test/conformance/README.md
Outdated
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.
IMO, this Environment requirements section and the Conformance test images section below should be moved above the Running conformance tests section. Going through the instructions for the first time, I found it slightly jarring to jump to the middle, then the end, then back to the beginning.
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.
kk will move, makes sense!
test/conformance/README.md
Outdated
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.
What do you think about using ~/.kube/config as the default? The ./kubeconfig file is checked in and empty, so not only will the above command never work for first-time users, it will also need to be scrubbed (or omitted) before every commit to avoid accidentally checking in local modifications.
From my dev perspective, the ideal setup would be for the conformance tests to detect the K8S_CLUSTER_OVERRIDE and DOCKER_REPO_OVERRIDE variables so the most common case could be supported without extra testargs.
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.
What do you think about using ~/.kube/config as the default?
I had this is initially, but then I got confused when I tried to make it so that bazel could run the tests. Afaik there is no way for me to make bazel able to use ~/.kube/config, this horrid empty file solution is the best thing I could come up with :(
But! I will make ~/.kube/config the default again, and update the bazel case in the docs to pass a path to the horrible empty file.
(Also in the future i'll be adding automation to run these tests, if that automation uses bazel then we might end up with some content in kubeconfig - I'll add a note about this in the commit message)
test/conformance/README.md
Outdated
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 wonder if we could make this verbose output the default? The tests take a while (70 seconds on my machine) so it's nice to see what's happening (and the Ginkgo output is very nice).
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 poked around and didn't find a great way to do this. If I come across something I'll come back to it, but I'm also hesitant because:
- It would mean
-vwould always be on forgo testwhich would be kind of odd i flater on we can run all the tests together - It feels weird to take the option away from the user
One way to handle it would be to add a script for invoking the tests which sets these flags - when I come back to this to add automation I think it'll be more clear what's worth scripting and what isn't.
Let me know if you feel strongly though and I'll continue the search!
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'll bump this up so it's the next example command after the bare go test ./test/conformance
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 don't feel strongly and I agree with all your points! 😃
test/conformance/route_test.go
Outdated
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.
Typo nit: "retrieve" and "manualy"
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.
ty ty!
test/README.md
Outdated
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 that using just "tests" (instead of "end to end" tests) would be better.
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.
hm the only thing is that the unit tests aren't in this directory 🤔 but I think you're right that just "tests" is better
test/README.md
Outdated
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.
Currently the controller/testing tests is failing to build, and cloudbuild/v1alpha1 is not covered.
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.
hm that's not good, not sure what's going on there, gonna have to look into it
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.
okay so it looks like the example test in hooks_test.go is actually broken. which means two things:
- it's broken (i'll open a bug about it)
- the go_test bazel rule doesn't run testable examples (i'll open a bug about this too but i need a good repro case first)
but either way go test -v ./pkg/... should be a totally legit way to run the tests
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'm embarrassed about the example failure! I've got a fix PR coming shortly.
I'm amazed that Bazel doesn't run example tests. Seems like it would have to go out of its way not to.
test/conformance/README.md
Outdated
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.
Can we create a script to make this a kinda no-op process?
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.
So there could be a script that:
- makes sure the kubeconfig file exists, has content, and is at the path that bazel expects
- makes sure the images have been built and pushed to the docker repo, builds and pushes them if they aren't there
I don't want to add this right now b/c tbh I feel like running these tests with bazel just causes more pain - it's way easier to use go test.
I'll be coming back to this to add automation - and some of that will be cluster setup so I think then it'll be clearer what's worth scripting.
But in the meantime @grantr suggested making ~/.kube/config the default config file, so that will work for most ppl (with go test anyway, not with bazel) so that helps a bit
test/conformance/README.md
Outdated
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.
Nit: most filenames in the repo use "_" or "-" to separate words, can you do that also with uploadtestimages.sh?
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.
looks like the scripts are mostly using - so I'll use that
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.
Typo: "required".
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.
ty ty
test/conformance/uploadtestimages.sh
Outdated
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.
Don't we need a copyright header here?
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.
oh yeah! i guess we need that in all the files actually
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.
test/unit_tests.sh
Outdated
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.
This shouldn't be needed. What motivated you to add this?
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 was trying to make it so that the script could be invoked from any directory, however it looks like bazel is already magically and apparently can find //test from any directory anyway so I guess it isn't needed!
vaikas
left a comment
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 so much for doing this!! I'm approving changes from my part assuming the other changes requested get done. I have tiny nits and would like to see this in asap :)
test/conformance/uploadtestimages.sh
Outdated
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.
tiny nit, in other files you do:
set -ex
which I believe is the same as this?
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.
fixed!
test/conformance/route_test.go
Outdated
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.
nit, I think it might be clearer to have isRevisionReady but don't care much.
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 like it!
test/conformance/crdpolling.go
Outdated
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.
+1 if we're talking about the function name.
I too might prefer something like:
PollUntilRouteReady
or
WaitUntilRouteReady / WaitForRouteReady / WaitRouteRead or something like that, I typically (not necessarily true) think that ExpectXXX means check for XXX and don't poll.
But if others are fine with Poll... I'm fine with that.
874e96b to
9b03f38
Compare
9b03f38 to
806f4f5
Compare
|
Okay I think I've addressed all of the feedback (thanks for the detailed review all!!). PTAL. |
Conformance tests are tests which can be run against any implementation of the Elafros API to ensure the API has been implemented consistently. Passing these tests would indicate that apps and functions deployed to this implementation could be ported to other implementations as well. The precedent for these tests is the k8s conformance tests which vendors use to prove they have "certified kubernetes" deployments. (https://github.com/cncf/k8s-conformance#certified-kubernetes) This commit includes one conformance test which deploys a new Route and Configuration from a prebuilt image, then updates the Configuration to use a different prebuilt image. Automation to run these tests will be coming later. The current solution to allowing bazel to run these tests is to configure bazel to use an empty kubeconfig file. This is pretty hacky and needs to be revisited later - if we use bazel to run our automated tests, we might put some meaningful values in this file. Fixes #89.
The conformance tests use Ginkgo and Gomega: * These are used by the existing k8s conformance tests * Having the same output as the k8s tests will allow us to integrate with tools that consume the k8s results (e.g. Sonobuoy) * The way tests are structured using Ginkgo (BDD) nicely mirros the way the API is specified, e.g. phases of rollout mapping exactly to steps in a Ginkgo test * Ginkgo output is human readable, widening the range of folks who can consume and interpret the results
806f4f5 to
c5d07a0
Compare
Conformance tests are tests which can be run against any implementation of the Elafros API to ensure the API has been implemented consistently. Passing these tests would indicate that apps and functions deployed to this implementation could be ported to other implementations as well. The precedent for these tests is the k8s conformance tests which vendors use to prove they have "certified kubernetes" deployments. (https://github.com/cncf/k8s-conformance#certified-kubernetes) This commit includes one conformance test which deploys a new Route and Configuration from a prebuilt image, then updates the Configuration to use a different prebuilt image. Automation to run these tests will be coming later. The current solution to allowing bazel to run these tests is to configure bazel to use an empty kubeconfig file. This is pretty hacky and needs to be revisited later - if we use bazel to run our automated tests, we might put some meaningful values in this file. The conformance tests use Ginkgo and Gomega: * These are used by the existing k8s conformance tests * Having the same output as the k8s tests will allow us to integrate with tools that consume the k8s results (e.g. Sonobuoy) * The way tests are structured using Ginkgo (BDD) nicely mirros the way the API is specified, e.g. phases of rollout mapping exactly to steps in a Ginkgo test * Ginkgo output is human readable, widening the range of folks who can consume and interpret the results Fixes #89.
Replace canonical_go_repository github.com/knative/serving with knative.dev/serving
* [SRVKS-988] Drop duplicate manifests (knative#81) * Drop duplicate manifests * keep * Drop openshift/release/artifacts * Add correct version * Revert Makefile * Set label version based on the branch name * [SRVKS-1000] Use SO repo's script to install serverless (knative#89) * Bump artifacts manifests

Conformance tests are tests which can be run against any implementation
of the Elafros API to ensure the API has been implemented consistently.
Passing these tests would indicate that apps and functions deployed to
this implementation could be ported to other implementations as well.
The precedent for these tests is the k8s conformance tests which
vendors use to prove they have "certified kubernetes" deployments.
(https://github.com/cncf/k8s-conformance#certified-kubernetes)
This commit includes one conformance test which deploys a new
Route and Configuration from a prebuilt image, then updates the
Configuration to use a different prebuilt image.
Automation to run these tests will be coming later.
The conformance tests use Ginkgo and Gomega:
with tools that consume the k8s results (e.g. Sonobuoy)
way the API is specified, e.g. phases of rollout mapping exactly to
steps in a Ginkgo test
consume and interpret the results
There are two commits which you can look at separately, one which adds tests/docs, the other which adds deps/BUILD (result of ./hack/update-deps.sh).
Fixes #89.