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

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

Open
oneingan opened this issue Jun 12, 2022 · 2 comments
Open

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

oneingan opened this issue Jun 12, 2022 · 2 comments

Comments

@oneingan
Copy link

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!

@jgough
Copy link

jgough commented Jun 13, 2022

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.

@oneingan
Copy link
Author

oneingan commented Jun 13, 2022

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"

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

2 participants