it is an E2E test
- User
it is an E2E test
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
it is an E2E test
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Since you’re doing a full end-to-end run—no code-level fakes, no unit tests—you really need to make your installed cert look expired (or make the process itself believe time has passed) without hand-editing a real, signed cert. In practice folks solve this in one of three ways:
Below are recipes for each. Pick whichever fits your infra best.
Have your E2E harness generate a cert whose NotAfter is in the past, then point the app at it on startup. The rotation logic sees “oops—expired!” and immediately replaces it.
# 1) create a key
openssl genpkey -algorithm RSA -out expired.key -pkeyopt rsa_keygen_bits:2048
# 2) self-sign with custom dates (start 2022, end 2022 → already expired)
cat > expired.ext <<EOF
[ req ]
distinguished_name = dn
x509_extensions = v3_req
[ dn ]
# no-op
[ v3_req ]
basicConstraints = CA:FALSE
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = test.local
EOF
openssl req -new -key expired.key -subj "/CN=test.local" \
| openssl x509 -req -in - -out expired.crt \
-extfile expired.ext \
-startdate 20220101000000Z \
-enddate 20220101000001Z
Then in your E2E setup, copy expired.crt + expired.key into the app’s cert directory before you boot it. On launch the rotation check will fire immediately.
If you can’t swap in a different cert at install but can control how the app is invoked, use [libfaketime] to pretend it’s months/years later. No host clock tricks, no refactor—just preload a library.
# 1) install libfaketime on your test box / container
sudo apt-get install libfaketime
# 2) launch the app
# – FAKETIME is any string your version of libfaketime understands
FAKETIME="2025-01-01 00:00:00" \
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 \
./start-your-app.sh
# 3) app thinks it’s Jan 1, 2025 → your 1-year cert is “expired”
# 4) assert the rotation logic kicked in
Pros:
Generate a cert with, say, 5 minutes of validity, install it, then in your test wait 5m+1s and assert rotation. It’s still E2E, but you’ll incur a real wait.
# create a 5-minute certificate
openssl req -x509 -newkey rsa:2048 -nodes \
-keyout short.key -out short.crt \
-subj "/CN=test.local" \
-days 0 -sha256 \
-set_serial $(date +%s) \
-startdate $(date -u +"%Y%m%d%H%M%SZ") \
-enddate $(date -u -d "+5 minutes" +"%Y%m%d%H%M%SZ")
Then:
short.crt/short.keysleep 310 (5m10s)Pick one of these, wire it into your CI pipeline or test harness, and you’ll have a reliable, automated E2E test of cert-rotation without ever hand-editing a signed cert. Good luck! 🚀
I cannot use a custom certificate as that will disable autorotation, which I am testing
Since you still need to let your app generate its own cert (so that the built-in auto-rotation logic stays live) the only way to make that cert look expired is to make the app believe “today” is after the NotAfter on the cert it just created. In an E2E context that usually means time-traveling the process or the OS clock—without ever touching the cert bytes.
Below are two battle-tested techniques:
— pick whichever fits your infra.
(Works on Linux/macOS binaries using glibc; no root, no real clock changes)
# Debian/Ubuntu
sudo apt-get update && sudo apt-get install -y libfaketime
FAKETIME at a date far enough in the future that your fresh cert is already expired:
# Example: make the app think it's Jan 1 2030
export FAKETIME="2030-01-01 00:00:00"
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
# start your app exactly as in production
./start-my-cert-rotator.sh --config ./prod.conf
time() / gettimeofday() call returns 2030 → it believes the cert is expired → triggers auto-rotation immediately.Pros:
(If you can run your E2E in an isolated VM/container and don’t mind “real” clock changes)
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y your-app-deps
COPY . /opt/myapp
WORKDIR /opt/myapp
ENTRYPOINT ["./start-my-cert-rotator.sh"]
docker run -it --rm \
--cap-add=SYS_TIME \
--name certtest \
myapp-image \
/bin/bash -c "
# shift system clock 1 year ahead
date -u -s '+365 days'
# now launch the real app (it sees the future time)
exec ./start-my-cert-rotator.sh
"
Teardown: the container dies, so your host clock stays untouched.
Set-Date in a Hyper-V/VM sandbox (requires admin in VM).Either way, your app still “generates its own” certificate at install-time—which immediately looks expired—and your E2E harness can then verify that the rotation logic fires exactly once. 🚀