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

Basic end to end test #220

Closed
zimnx opened this issue Nov 2, 2020 · 5 comments · Fixed by #231
Closed

Basic end to end test #220

zimnx opened this issue Nov 2, 2020 · 5 comments · Fixed by #231
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@zimnx
Copy link
Collaborator

zimnx commented Nov 2, 2020

Currently we don't have any automatic test in this repo which would validate even basic scenario such as spawning 1 rack with 3 nodes cluster.

For a start, we should have a test which spawns ScyllaCluster on local minikube.
Once we have baseline, all new features should come together with tests.

@zimnx zimnx added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 2, 2020
@espindola
Copy link
Contributor

It would be really nice if the basic tests were not integration tests. Since the only thing an operator does is talk http, it is trivial to mock the other side.

We should still have integration tests, not only with Minikube but with any implementation we support (amazon, google, etc), but with good local tests we don't need to run that during the regular development cycle.

@yanniszark
Copy link
Collaborator

yanniszark commented Nov 2, 2020

@zimnx @espindola may I recommend taking a look at k3d?
https://github.com/rancher/k3d

It's super-lightweight, works well with GitHub workflows and allows for multi-node clusters.
For instance, we use it in our oidc-authservice repo with great success. I've written a small blog post about it in case you are interested:
https://www.arrikto.com/devops/k3d-github-actions-kubernetes-e2e-testing-made-easy/

The test is very lightweight and runs in about 3 minutes (sets up k8s cluster, applies YAML, waits and performs checks).
I think it would also work great for testing the Scylla operator end-to-end, without slowing down development speed.

@espindola
Copy link
Contributor

espindola commented Nov 2, 2020 via email

@yanniszark
Copy link
Collaborator

yanniszark commented Nov 2, 2020

If I understand it correctly, it is basically a lighter version of
minikube?

More or less. Plus, it supports multi-node setups, using multiple docker containers.

If so I don't see why not moving from minikube to it for both
development and first pass at integration tests.

I would recommend doing so.

I still think there is value in having dedicated "unit" tests by mocking
the API server:

Of course :) Both are needed (integration and e2e).
Let me share the approaches I have seen so far:

I don't think the approaches above can simulate errors, but you can probably achieve that if client is an interface (which it is).

As an example, I wrote an independent implementation of the sample
controller. It is at

This is great! You should do a blog post with that in the future, it would be very educational!

@espindola
Copy link
Contributor

espindola commented Nov 2, 2020 via email

zimnx added a commit that referenced this issue Nov 9, 2020
This commits brings first integration test using partially
stubbed k8s cluster. Real ETCD and kubeapi binaries are spawned
before test suite.

First scenario validates scaling up scenario.

Fixes #220
zimnx added a commit that referenced this issue Nov 16, 2020
This commits brings first integration test using partially
stubbed k8s cluster. Real ETCD and kubeapi binaries are spawned
before test suite.

First scenario validates scaling up scenario.

Fixes #220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants