elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
695 stars 70 forks source link

ci: improve scripts for local development #188

Open tommilligan opened 2 years ago

tommilligan commented 2 years ago

I picked up this repo recently to work on while commuting, when I'm often offline. This PR implements some tidyups I found useful.

Support offline test running

Currently cargo make test will fail if you're offline, as it will always attempt to pull the remote docker image.

This PR implements the environment variable DOCKER_PULL_ATTEMPTS to make this optional:

DOCKER_PULL_ATTEMPTS=0 STACK_VERSION=7.14.0 cargo make test

Dump logs for shutdown/errored containers

My test elasticsearch instance failed to start (I was running an older version, 7.10.0, which wasn't supported). This was opaque to debug as the container is instantly deleted on shutdown (docker run --rm).

This PR implements always dumping logging from the elasticsearch instance. It does this by not deleting the container automatically, and instead deleting it explicitly after dumping logs. Previous containers also deleted if found by the next test run.

Please note that the impact of this is that some containers may still be left from the test run on the user's system. I believe this is desirable anyway for inspection after failure.

elasticmachine commented 2 years ago

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?