-
-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up automated bash tests with bats #1721
Conversation
@jdeanwallace sorry for the PR/review flood… I’m not blocked by any of them, so no pressure from my side, especially if you want to play around a bit with bats. |
…ons/2-tests # Conflicts: # .dockerignore
Automated comment from CodeApprove ➜👀 @jotaen4tinypilot it's your turn, please take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automated comment from CodeApprove ➜
Nice, bats looks pretty cool.
👀 @jotaen4tinypilot it's your turn please take a look
Related #1710. This PR adds a unified script to remove TinyPilot marker sections from files. We will [use this script in a subsequent PR](#1722) to simplify the corresponding instances in the [unset-static-ip](https://github.com/tiny-pilot/tinypilot/blob/2e211199a21a2a6c285c5d1d2ff60eff6afa77d4/debian-pkg/opt/tinypilot-privileged/scripts/unset-static-ip#L64-L81) and [change-hostname](https://github.com/tiny-pilot/tinypilot/blob/8e99d5a666df12d851b14dd4276e8b95ab958493/debian-pkg/opt/tinypilot-privileged/scripts/change-hostname#L62-L79) privileged scripts. ## Notes - Unless someone feels strongly about the [originally mentioned `remove-tinypilot-lines` script name](https://github.com/tiny-pilot/tinypilot/issues/1710#:~:text=opt/tinypilot/scripts/-,remove%2Dtinypilot%2Dlines,-%3C%20example.conf) (or any other name), I thought that `strip-marker-sections` sounded most expressive. - I added a comment to the `lib/markers.sh` file, to explain the marker idea in a bit more detail. - There will be automated bash tests for this in [a subsequent PR](#1721). <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1720"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a> --------- Co-authored-by: Jan Heuermann <[email protected]>
Resolves #1714.
Related #1710.
Stacked onto #1720.
This PR sets up bash tests with bats, and adds a first test suite for the
strip-marker-sections
script.Notes
.bats
test file next to the script under test. The directive in.dockerignore
removes it from the bundle /.deb
file.build_bash
dev script is called “build” for consistency withbuild_python
andbuild_javascript
, even though we technically don’t build something. I’ve created Consolidate naming and responsibility of dev scripts #1716 for us to potentially reconsider this overall.build_bash
, it somehow felt reasonable to me to search all places that are likely to contain.bats
files, even though we currently only have them in/opt/tinypilot-privileged/scripts/
. I don’t feel strongly about this, though./bin/bash
, so it fails to execute any of our bash scripts that have a#!/bin/bash
shebang (which is effectively all of them). We instead would either have to change all our shebangs to the (most portable)#!/usr/bin/env bash
shebang, or we just install bats manually like done here (in the Circle conf).