Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Latest commit

 

History

History
70 lines (50 loc) · 2.07 KB

File metadata and controls

70 lines (50 loc) · 2.07 KB

Shellcheck Tests

Shellcheck tests must be executed explicitly via pytest shellcheck (see Running the Tests), and will not be executed as part of other pytests (e.g. the integration tests). The tests do not require a running Garden Linux instance. Neither do the test require the repository to be in a buildable state.

Prerequisites

The gardenlinux/integration-test container has all dependencies installed that are required to run the shellcheck tests. Build the container image from the base directory of this repository by running:

make --directory=container build-integration-test

Configuration Options

Details

Severity Level
determines for what kind of findings the shellcheck tests should fail.
Starting from the most sensitive, to least sensitive, the available levels are: error, warning, info, style

pytest shellcheck --severity=error

Ignoring Shellcheck errors/warnings
The text file tests/shellcheck/error.ignore is a line separated list of errors that must be ignored by the shellcheck pytests.

# Comments start with '#' and will be ignored

SC1090

Ignoring files
The text file tests/shellcheck/file.ignore is a line-separated list of paths starting from the Garden Linux repo root, that must be ignored in the shellcheck pytests.

# Comments start with '#' and will be ignored

# All files must be specified relative to the root dir of this repository
bin/
ci/

# Explicitly ignore single file
docker/build/install-cfssl.sh

Running the Tests

Start the container

  • mount Garden Linux repository to /gardenlinux
docker run -it --rm -v `pwd`:/gardenlinux gardenlinux/integration-test:`bin/garden-version` /bin/bash

Run the rests

pytest shellcheck

Running Shellcheck manually

shellcheck <path-to-file> to run shellcheck manually and get output for a single file. You can also integrate shellcheck in your editor. Checkout the github readme from the koalaman/shellcheck repo for more information.