Repository navigation
Conversation
Signed-off-by: amh1k <abdulmoizx97@gmail.com>
Signed-off-by: amh1k <abdulmoizx97@gmail.com>
Verify execution against disposable MySQL, preserve preparation failure exit status, and document configuration and local usage. Signed-off-by: amh1k <abdulmoizx97@gmail.com>
spron-in
left a comment
There was a problem hiding this comment.
Thanks for this, it's a solid runner! It follows the pgbench runner contract closely, and I checked the config-file encoding against sysbench 1.0.20's read_config parser in sb_options.c: the quote selection, the rejected characters, and the 254-byte line limit all match. The MySQL smoke script is thorough too (the FLUSH PRIVILEGES full-auth check and the preserved-row check are nice touches).
I left one main point on the round-trip test plus a few optional nits inline.
Question on scope: the runner doesn't expose TLS settings yet (e.g. --mysql-ssl, --mysql-ssl-ca, and friends) or a connect timeout, so clusters that require secure transport will fail to connect. The pgbench runner passes PGSSLMODE and PGCONNECT_TIMEOUT through. Are you planning to add TLS support (and ideally a connect timeout) in a follow-up PR? I'm fine with that not blocking this one.
Minor: the README is quite long (≈270 lines). The local example and cleanup sections could probably be trimmed, but that's optional.
| func TestConnectionConfigRoundTripsThroughSysbench(t *testing.T) { | ||
| executable, err := exec.LookPath("sysbench") | ||
| if err != nil { | ||
| t.Skip("sysbench is not installed; run this check with the image's toolchain") |
There was a problem hiding this comment.
This is the only test that sends the encoding through sysbench's real parser, and that encoding is the riskiest logic in the PR. But sysbench isn't installed on the CI runner, so the test always skips there, and per the README it has only been run by hand inside the image.
Could the Sysbench Runner job run it inside the built image? For example, after docker build:
cd runners/sysbench
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go test -c -o /tmp/sysbench-runner.test .
docker run --rm --entrypoint /tmp/sysbench-runner.test \
-v /tmp/sysbench-runner.test:/tmp/sysbench-runner.test:ro \
plugin-bench-sysbench:ci -test.run '^TestConnectionConfigRoundTripsThroughSysbench$' -test.v \
| tee /tmp/roundtrip.log
! grep -q -- '--- SKIP' /tmp/roundtrip.logThe final grep makes the job fail if the test silently skips (for example, if the binary is missing from PATH).
| value = `"` + value + `"` | ||
| case strings.ContainsRune(value, ',') || strings.ContainsFunc(value, unicode.IsSpace) || strings.ContainsAny(value[:1], "'\"#"): | ||
| return nil, fmt.Errorf("%s cannot be represented in the sysbench configuration file", field.setting) | ||
| } |
There was a problem hiding this comment.
nit: values containing both quote types are written unquoted only because none of the cases match. An explicit default would make that path easier to see:
| } | |
| default: | |
| // Both quote types present: sysbench reads the value unquoted. | |
| } |
| # package includes the Lua workloads and pulls in the MySQL client library. | ||
| RUN set -eu; \ | ||
| apt-get update; \ | ||
| apt-get install -y --no-install-recommends sysbench=1.0.20+ds-5; \ |
There was a problem hiding this comment.
nit: pinning the exact Debian package revision means the build breaks as soon as bookworm (now oldstable) ships an updated sysbench package, because apt won't find 1.0.20+ds-5 anymore. The build-time grep -Eq '^sysbench 1\.0\.20$' already guards the version that matters. For reproducible builds, consider pinning the base image by digest instead (FROM debian:bookworm-slim@sha256:...) and dropping the +ds-5 revision, or pinning to sysbench=1.0.20*.
| @@ -0,0 +1,3 @@ | |||
| module github.com/openeverest/plugin-bench/runners/sysbench | |||
|
|
|||
| go 1.25 | |||
There was a problem hiding this comment.
nit: nothing in the runner seems to need Go 1.25 (the newest feature I spotted is the min builtin from 1.21), while runners/pgbench targets go 1.22. Consider aligning the two runners, either lowering this to 1.22 or bumping both together, so the CI matrix stays consistent.
| umask 077 | ||
| config=$(mktemp /tmp/sysbench-cleanup.XXXXXX) | ||
| trap '\''rm -f "$config"'\'' EXIT | ||
| printf "mysql-host=%s\nmysql-port=%s\nmysql-db=%s\nmysql-user=%s\nmysql-password=%s\n" \ |
There was a problem hiding this comment.
nit: this writes the password unquoted, so it only works for simple values. The text says so, but the snippet is easy to copy. Quoting the values keeps it closer to what the wrapper does and handles spaces, #, and commas:
| printf "mysql-host=%s\nmysql-port=%s\nmysql-db=%s\nmysql-user=%s\nmysql-password=%s\n" \ | |
| printf "mysql-host='%s'\nmysql-port=%s\nmysql-db='%s'\nmysql-user='%s'\nmysql-password='%s'\n" \ |
Summary
Closes #63
Add a standalone sysbench runner for MySQL with optional table preparation, secure credential handling, and structured TPS/latency metrics. Include a non-root Docker image, documentation, and CI coverage.
Backend and frontend integration follow separately.
Verification