See Ash Code logo See Ash Code

A deployment test also needs to reject the old path

Ashlynn Antrobus
• • 2 min read

A deployment test can find the new path and still miss a request to upload the old one.

The January 5 deployment review change restores a negative assertion in my BATS test. The test already checked that the rsync log contained the expected paths. It also needed to reject a deprecated one.

The assertion is small:

assert_not_contains "$output" "blog/backend/"

It asks a different question from the assertions immediately around it.

Presence doesn’t establish absence

The test reads a captured rsync log and checks for the application source, expected destination, and SSH invocation. The relevant assertions include:

assert_contains "$output" "monorepo/backend/src/backend/"
assert_contains "$output" "seeash/src/backend/"
assert_not_contains "$output" "blog/backend/"

Suppose a teaching example of that log contained an upload from the new source directory and another upload from the old blog/backend/ directory. The positive source check would pass. It found the string it was looking for.

But the deployment would still be using the old path somewhere. The negative check is what makes that combination fail.

A red road sign reads “Wrong Way.”

Photo by Eranb, via Wikimedia Commons; released into the public domain.

That is particularly useful in a deployment script with several upload commands. Correcting one command doesn’t establish that every other command stopped using the previous layout.

Check the invocation separately from the remote site

The surrounding change also adjusts upload destinations, trailing slashes, and the WSGI entry-file upload. Those details affect which files land in which remote directory.

The BATS test checks the commands through their captured log. That gives it a local, repeatable way to detect a path regression without uploading files to production during the test.

It doesn’t inspect the remote filesystem or load the deployed application. A log assertion can show that the script requested the right transfer; it can’t establish that the website served a successful response afterward.

I want those checks at their own boundaries. Path selection belongs in the script test. Transfer success and application startup require additional observations.

What the regression is supposed to prevent

If a later edit reintroduces blog/backend/ while leaving the new upload intact, I want the test to fail. Merely checking that the new code still exists would miss the behavior I was trying to retire.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.