summaryrefslogtreecommitdiff
path: root/gemfeed/2021-10-22-defensive-devops.md
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-01 17:45:52 +0200
committerPaul Buetow <paul@buetow.org>2026-03-01 17:45:52 +0200
commit8de87695cfec4e224e17c8c07da209132d72d9d5 (patch)
tree23ea2af5e1bbd3d15b482f122c00e185035580b9 /gemfeed/2021-10-22-defensive-devops.md
parent77f8c07984a54ea491ec4ed949691278c7c5d3f7 (diff)
Update content for md
Diffstat (limited to 'gemfeed/2021-10-22-defensive-devops.md')
-rw-r--r--gemfeed/2021-10-22-defensive-devops.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/gemfeed/2021-10-22-defensive-devops.md b/gemfeed/2021-10-22-defensive-devops.md
index 2fa5849a..6eec17ec 100644
--- a/gemfeed/2021-10-22-defensive-devops.md
+++ b/gemfeed/2021-10-22-defensive-devops.md
@@ -79,7 +79,7 @@ Furthermore, when you write Bash script, always run the tool ShellSheck (https:/
You probably won't have time for writing unit tests. But what you can do is to pedantically test your code manually. But you have to do the testing on a production machine. So how can you test your code in production without causing more damage?
-Your script should be idempotent. This means you can run it infinite times in a row, and you will always get the same result. For example, in the first run of the script, a file A get's renamed to A.backup. The second time you run the script, it attempts to do the same, but it recognises that A has already been renamed to A.backup and then it is skipping that step. This is very helpful for manually testing, as it means that you can re-run the script every time you extended it. You should dry-run the script at least once before running it for real. You can apply the same principle for almost all features you add to the code.
+Your script should be idempotent. This means you can run it infinite times in a row, and you will always get the same result. For example, in the first run of the script, a file A get's renamed to A.backup. The second time you run the script, it attempts to do the same, but it recognises that A has already been renamed to A.backup and then it is skipping that step. This is very helpful for manually testing, as it means that you can re-run the script every time you extended it. You should dry-run the script at least once before running it for real. You can apply the same principle for almost all features you add to the code.
You may also want to inject manual negative testing into your script. For example, you want to run a particular function F in your script but only if a certain pre-condition is met, and you want to ensure that the code branching works as expected. The pre-condition check could be pretty complex (e.g. N log messages containing a specific warning string are found in the applications logs, but only on the cluster leader server). You can flip the switch directly in the code manually (e.g. run F only, when the pre-condition isn't met) and then perform a dry run of the script and study the output. Once done, flip the switch back to its correct configuration. For double insurance, test the same on a different server type (e.g. on a follower and not on a leader system).