Skip to content

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

Screen_Shot_2022-06-17_at_10.28.28_PM

FAIL

Screen_Shot_2022-06-17_at_10.23.25_PM

How to set up and validate locally

  1. Run scripts/glfm/run-snapshot-tests.sh and see it pass.
  2. Ensure return code (echo $?) is 0
  3. Introduce a failure into spec/requests/api/markdown_snapshot_spec.rb
  4. Run scripts/glfm/run-snapshot-tests.sh again and see it fail
  5. Ensure return code (echo $?) is 1

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Chad Woolley

Merge request reports

Loading