Initial implementation of smoke tests
A simple implementation of smoke tests based on Vagrant.
Fixes https://github.com/kinvolk/kube-spawn/issues/56
This test works well when we run ./scripts/test-smoke.sh on our own. Next step would be to run the script automatically when each PR is made.
Unfortunately at the moment CI services like semaphoreCI or circleCI are based on Ubuntu 14.04, where neither vagrant nor VirtualBox is installed. So I wanted to somehow install vagrant & virtualbox from test-smoke.sh. It didn't work well, as there's no kernel tree inside chroot environment, which prevents vbox kernel modules from getting built. Anyway it's not a good idea at all to build kernel modules every time.
Next attempt was to make use of vagrant-libvirt, instead of virtualbox. Then we don't need to build vbox kernel modules at all. For that, I needed to support libvirt in Vagrantfile of kube-spawn. (See https://github.com/dongsupark/kube-spawn/tree/dongsu/smoke-test ) That works perfectly on most recent distros like Fedora 26, Ubuntu 17.04, but not on Ubuntu 14.04 of SemaphoreCI, where vagrant-libvirt package doesn't exist. Installing the package manually caused the whole dependency chain to be fetched. Not good at all.
So I would rather keep this PR based on virtualbox instead of libvirt. Maybe later when semaphoreCI supported Ubuntu 16.04, we will be able to make test-smoke.sh run integrated with semaphoreCI.
EDIT: Another issue is that /dev/net/tun is not available inside lxc containers provided by semaphoreCI and CircleCI. The result is KVM networking being completely unusable.
Updated.
- added tests for creating deployments, services etc.
- Fixed a name of Fedora Vagrant image.
- Used trap for cleaning up.
As far as I can see, it doesn't test if the pods/services are actually running and reachable over the network endpoints. IMHO we should test this.
@nhlfr Also I would need to change commands according to the new design of v0.2. I would also need to try to run this PR on semaphore CI, to check if the total download size still exceeds the limit from the provider. Also need to try either libvirt or virtualbox, etc.
Rebased. Updated every necessary change according to the redesigned CLI from the current master branch. Added a connectivity test that exposes a deployment, and checks if the cluster IP is reachable from a node.