k3s-io/kine

Please document how to run the tests locally without drone CI

Opened this issue ยท 5 comments

oz123 commented

I am trying to figure out the right order of running the scripts for testing, under script.
It seems the I can use drone.yml as a guidance. However, some variables seem supplied by the drone-ci environemen.

oz123 commented

It seems that make lists a collection of targets from scripts directory?

$ make test-load 

and all other targets fail.

Still, this is really unexpected.

docker build -t kine:test-<git-hash> -f Dockerfile.test .
docker run -i -e ARCH -e REPO -e TAG  -e DRONE_TAG -e IMAGE_NAME -v /var/run/docker.sock:/var/run/docker.sock -v kine-cache:/go/src/github.com/k3s-io/kine/.cache --privileged kine:test--<git-hash>"./scripts/test sqlite"

still works.

You need to set the environment variables (-e ARCH and so on) to the correct values.

Something like this should do it:
ARCH=$(go env GOARCH) DRONE_COMMIT=$(git rev-parse HEAD) sh -c 'docker build -t kine:test-${DRONE_COMMIT} -f Dockerfile.test . && docker run -i -e ARCH -e REPO -e TAG -e DRONE_TAG -e IMAGE_NAME -v /var/run/docker.sock:/var/run/docker.sock -v kine-cache:/go/src/github.com/k3s-io/kine/.cache --rm --name kine-test --privileged kine:test-${DRONE_COMMIT} "./scripts/test mysql"'

oz123 commented

Can we add theses as explicit make file targets with proper depencies between the targets?
Or at least a Contributing files explaining this?

it would be nice if there were makefile targets, yeah. PR welcome!

This becomes simplier if you just use the Drone CLI. Then you can just call

drone exec --trusted --pipeline=amd64 --event=pull-request

This will launch all of the DB tests. It runs everything in docker containers on your local machine.

If you want to just run a single test, use the --include flag:

drone exec --trusted --pipeline=amd64 --event=pull-request  --include=test-mysql --include=build --include=test-image