Add scripts/glfm/run-snapshot-tests.sh
What does this MR do and why?
Related: Tracking Issue: Implement GLFM scripts per the ... (#361241 - closed)
Introduces scripts/glfm/run-snapshot-tests.sh
as documented in https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#run-snapshot-testssh-script
But Chad, why is this script written in bash when all the others are written in Ruby?
My general rule for writing shell scripts is to avoid writing shell scripts whenever possible
However, for this particular case it's the simplest and best solution. I explain the reasoning behind this in the GLFM Specification Guide "Scripts" section:
Some of these scripts are implemented in Ruby, and others are shell scripts. Ruby scripts are used for more complex custom scripts, to enable easier unit testing and debugging. Shell scripts are used for simpler scripts which primarily invoke other shell commands, to avoid the challenges related to running other shell sub-processes from Ruby scripts.
Screenshots or screen recordings
PASS
FAIL
How to set up and validate locally
- Run
scripts/glfm/run-snapshot-tests.sh
and see it pass. - Ensure return code (
echo $?
) is0
- Introduce a failure into
spec/requests/api/markdown_snapshot_spec.rb
- Run
scripts/glfm/run-snapshot-tests.sh
again and see it fail - Ensure return code (
echo $?
) is1
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.