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

Please document how to run the tests locally without drone CI #239

Open
oz123 opened this issue Nov 3, 2023 · 5 comments
Open

Please document how to run the tests locally without drone CI #239

oz123 opened this issue Nov 3, 2023 · 5 comments
Assignees

Comments

@oz123
Copy link
Contributor

oz123 commented Nov 3, 2023

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

oz123 commented Nov 3, 2023

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.

@brandond
Copy link
Member

brandond commented Nov 3, 2023

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

oz123 commented Nov 3, 2023

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

@brandond
Copy link
Member

brandond commented Nov 3, 2023

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

@dereknola
Copy link
Member

dereknola commented Nov 10, 2023

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

@dereknola dereknola self-assigned this Nov 14, 2023
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

No branches or pull requests

3 participants