logstash-filter-verifier icon indicating copy to clipboard operation
logstash-filter-verifier copied to clipboard

Run test in daemon mode as a single command (start + run)

Open oneingan opened this issue 3 years ago • 2 comments

I'd like to incorporate testing framework into automatic dev workflow (CI/CD pipeline, Git pre-hook script, Makefile and more). Do you have any hint about how I may launch tests? Or maybe I need a workaround wrapper command which: 1. start daemon, 2. run tests, 3. stop daemon?

something like logstash-filter-verifier daemon run --start-daemon --stop-daemon option will be huge.

Regards and thanks for your work. Be able to test pipeline-to-pipeline complex designs is amazing!

oneingan avatar Jun 12 '22 21:06 oneingan

In our CI in Gitlab I run our tests in a docker container with something along these lines:

docker run --rm -d --name logstash-filter-verifier-$CI-COMMIT_SHA my-logstash-image daemon start
sleep 10
docker exec logstash-filter-verifier-$CI-COMMIT_SHA daemon run ...

The stopping is dealt with by Gitlab. Not ideal but it does work.

jgough avatar Jun 13 '22 10:06 jgough

My 2 cents

#!/usr/bin/env bash

TMPDIR=$(mktemp -d)

(logstash-filter-verifier daemon start \
       	--socket "$TMPDIR"/logstash-filter-verifier.sock \
	--logstash-path /path/to/logstash \
        --keep-env PATH 2>&1 &) | grep -q "Ready to process tests"

logstash-filter-verifier "$@" --socket "$TMPDIR"/logstash-filter-verifier.sock
sleep 2
logstash-filter-verifier daemon shutdown --socket "$TMPDIR"/logstash-filter-verifier.sock
rm -rf "$TMPDIR"

oneingan avatar Jun 13 '22 22:06 oneingan